Generating Multi Level Nodes In Stored Procedures
Jul 23, 2005
Hi all,
What I am trying to do is generate a stored procedure that is desired
to output XML in this type of format
<Parent Device>
<Device>
<Device ID>1</DeviceID>
<ChildRegister>
<ChildRegisterID>22</ChildRegisterID>
</ChildRegister>
</Device>
<Device>
<Device ID>2</DeviceID>
<ChildRegister>
<ChildRegisterID>23</ChildRegisterID>
</ChildRegister>
</Device>
</Parent Device>
The area of concern is the child register, the XML being generated
disregards the Device the ChildRegister belongs to and always places it
as elements of the last device.
<Parent Device>
<Device>
<Device ID>1</DeviceID>
</Device>
<Device>
<Device ID>2</DeviceID>
<ChildRegister>
<ChildRegisterID>23</ChildRegisterID>
</ChildRegister>
<ChildRegister>
<ChildRegisterID>22</ChildRegisterID>
</ChildRegister>
</Device>
</Parent Device>
I am trying to produce XML like the first one I described and have yet
to discover a way of associating the ChildRegister with the parent
Device in XML. I am not sure if it is a limitation of SQL Server, or if
my implementation is incorrect. If anyone could post hints or
solutions, I would greatly appreciate it.
A shortened version of the stored procedure is below
Cheers :)
Alvin
SELECT
1AS TAG
,NULL AS PARENT
,NULL AS [Device!2!DeviceID!element]
,NULL AS [ChildRegister!3!RegisterID!element]
FROM udetails INNER JOIN
Detail ON udetails.ID = Detail.ID
WHERE (uDetails.JobID = @ID)
UNION ALL
SELECT
2 AS TAG
,1 AS PARENT
,TempTable.DeviceIDAS [Device!2!DeviceID!element]
,NULL AS [ChildRegister!3!RegisterID!element]
[color=blue]
>From #Temp as TempTable INNER JOIN[/color]
device ON TempTable.DeviceID = device.DeviceID
UNION ALL
SELECT
3 AS TAG
,2 AS PARENT
,NULL AS [Device!2!DeviceID!element]
,RegisterID AS [ChildRegister!3!RegisterID!element]
FROM #Temp t INNER JOIN
register ON t.DeviceID =
register.DeviceID
FOR XML EXPLICIT
View 1 Replies
ADVERTISEMENT
Jan 17, 2007
Hi!
Let's say users of my app can build some reports based on a current database schema and my custom-database adapter will generate some SQL to get the right data. User can save his report template ( basically data needed to create SQL ) in some storage. Will it be better solution to generate stored procedure for such report and save stored proc to a database and their name with raport data so next time user needs this report it will use stored proc.
Jarod
View 1 Replies
View Related
Jan 28, 2004
hi,
I want to execute two user created stored procedures in a multithreaded manner in ms-sql server . Can some tell me how i can do that.
Thanks in advance.
Regards,
Manpreet
View 14 Replies
View Related
Apr 19, 2007
Hi!
In my database I have all business logic in stored procedures. For example there are procedures: ReadBike and UpdateBike. Bike is business object stored in 4 tables.
On my system work 100 employees and we have one problem with this. The stroy is;
1. User A reads data about Bike1
2. User B reads data about Bike1
3. User A updates data about Bike1 (user B have old data)
4. User B updates data about Bike1
So user B don't know about chnages made by user A. How to solve that ptroblem?
It's probably solved in ADO, but I want use business login in procedures.
Regards,
Walter
View 1 Replies
View Related
May 7, 2007
Hi All,
I require to compare two database structures.This is what I went for:
I generated scripts (right click on the database --> All Tasks--> Generate Scripts) for all tables in the two given databases and compared them.
The problem is that the order of the tables in the generated scripts are different. Can I control this order by any possible means?
Thanks in advance.
View 4 Replies
View Related
Aug 28, 2006
Hello,
I am using SRS 2000 and was wondering if there is any way to have more than 1 level in my document map.
Here is the scenario:
I have a report that displays
Customer
Contract 1
Project 1
Project 2
Contract 2
Project 1
Project 2
etc...
I would like the document map to include a list of Customers, Contracts and Projects as some people who view the report know the contract code they are interested in, others know the project code and others know the customers.
However, when I set it up I get a list with them all jumbled together:
Report Name
Customer 1
Project 1
Customer 2
Contract 1
etc...
I would like the document map to have separate levels for each of them:
Report Name
Customer
Customer 1
Customer 2
Contract
Contract 1
Contract 2
Project
Project 1
Project 2
Does anyone know if this is possible?
Thanks,
Paul.
View 7 Replies
View Related
Aug 2, 2007
Hi...
I'm trying to generate scripts in SQL Server Management Studio 2005.
When I choose 'Script all objects' I get an error when I try to execute it. When I generate the scripts in single files, only tables in one file, only views in one file etc. etc., the execution is succeded.
1) Why do I get an error when I try to execute the script containing tables, views, procedures in one file....?
2) I get an error in the view-file where one column is 'invalid' but I can see it in the view. A generated script should execute succesfully when it is generated one second ago on the same database and so on... Right?
Thanks....
View 7 Replies
View Related
Feb 4, 2008
the stored procedure don't delete all the records
need help
Code Snippet
DECLARE @empid varchar(500)
set @empid ='55329429,58830803,309128726,55696314'
DELETE FROM [Table_1]
WHERE charindex(','+CONVERT(varchar,[empid])+',',','+@empid+',') > 0
UPDATE [empList]
SET StartDate = CONVERT(DATETIME, '1900-01-01 00:00:00', 102), val_ok = 0
WHERE charindex(','+CONVERT(varchar,[empid])+',',','+@empid+',') > 0
UPDATE [empList]
SET StartDate = CONVERT(DATETIME, '1900-01-01 00:00:00', 102), val_ok = 0
WHERE charindex(','+CONVERT(varchar,[empid])+',',','+@empid+',') > 0
TNX
View 2 Replies
View Related
Mar 21, 2007
I am attempting to do the following....
I have standard tree setup. The tree can be up to 4 nodes deep. User permissions may be assigned at any level in the tree. Any
permission should cascade down the tree to the lowest child node.
For example, if a user had a role of 1 for the root node (101), the sql should return:
OrgID RoleID
101 1
102 1
103 1
etc...
My table structure is as follows....
Org
OrgID ParentID
101 Null
102 101
103 101
105 102
106 102
107 105
108 105
109 106
110 106
111 106
UserOrgRole
UserID OrgID RoleID
User1 101 1
User1 102 2
User1 103 2
User1 107 2
User2 101 1
User3 106 3
etc...
What I would like to retrive from the above table data is....
OrgID RoleID
102 2
105 2
106 2
107 2
108 2
109 2
110 2
111 2
This is so because all the nodes (except for 101 and 103) are somehow decedent from the 102 node and 102 has a roleid of 2. I am only concerned with the RoleID 2 and User1.
I have worked for two days trying to figure out how to do this. I am not a DBA or SQL expert by any means. I cannot seem to figure
out how to traverse multiple levels of the tree. I have been using the new CTE and made some progress, but I think I reached my
plateau and haven't been able to get any further.
If someone could help me, I would be forever in your debt! I am really starting to get very frustrated and I know there are some of
you experts out there that would know exactly what to do.
thanks!
View 19 Replies
View Related
Sep 7, 2007
this is so stupid and simple and I am annoyed over having to spend so much on this silly simple stuff.
I am sure I am just making a silly mistake.
I am trying to remove records from one table. The table holds 19000 something records.
To determine WHICh records to delete, I have another table that contains the 45 I want to delete.
So I wrote this very simple query
Delete from tbl_X
where tbl_X.FieldA = tbl_Y.FieldA;
The message I get is:
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "tblY.FieldA" could not be bound.
Please tell me I am stupid!
Thanks!
View 8 Replies
View Related
Jul 23, 2015
SSRS 2008 R2
I have two level of grouping Example:
:::HEADER:::
A [GROUPING 1]
B[GROUPING 2]
C[GROUPING 2]
When I apply Page Break
:::HEADER:::
A [GROUPING 1]
B[GROUPING 2]
:::HEADER:::
A [GROUPING 1]
C[GROUPING 2]
[URL]
View 3 Replies
View Related
Sep 7, 2006
Hi chaps,
I have the following SQL query (SQL 2005).
Its basically retrieving some values using simple joins.
However there appears to be a problem with the LEFT OUTER JOIN:
"LEFT OUTER JOIN DDDispatchedOrder ON (OrderLineItemTransaction.OrderLineItemTransaction ID = DDDispatchedOrder.OrderItemTransactionID)
"
When I try to compile the code i Get :
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "OrderLineItemTransaction.OrderLineItemTransactionI D" could not be bound.
Any help would be appreciated.
Cheers
Bal
SELECT
ord.orderDate,
cc.forename + ' ' + cc.surname person,
prod.description,
oli.noofitems,
deladdr.housenameno + ' ' + deladdr.addressLine1 + ' ' + deladdr.addressLine2 + ' ' + deladdr.city + ' ' + deladdr.postcode + ' ' + deladdr.county + ' ' + deladdr.country deladdress
FROM
product prod,
OrderLineItem oli,
[Order] ord,
OrderTransaction ordT,
OrderLineItemTransaction oliT,
CustomerContact cc,
Customer cust,
DDDispatchedOrder dd,
address deladdr,
address invaddr
LEFT OUTER JOIN DDDispatchedOrder ON (OrderLineItemTransaction.OrderLineItemTransaction ID = DDDispatchedOrder.OrderItemTransactionID)
WHERE
prod.productID = oli.productID:eek:
AND ord.orderID = oli.orderID
AND ord.orderID = ordT.orderID
AND oliT.orderlineitemID = oli.orderlineitemID
AND cc.customercontactID = ord.customercontactID
AND cc.customerID = cust.customerID
AND ord.invoiceaddressID = invaddr.addressID
AND ord.deliveryaddressID = deladdr.addressID
AND ordT.dispatchTypeID = 2
View 7 Replies
View Related
Jul 23, 2005
I want to know the differences between SQL Server 2000 storedprocedures and oracle stored procedures? Do they have differentsyntax? The concept should be the same that the stored proceduresexecute in the database server with better performance?Please advise good references for Oracle stored procedures also.thanks!!
View 11 Replies
View Related
Sep 30, 2006
Hi,
This Might be a really simple thing, however we have just installed SQL server 2005 on a new server, and are having difficulties with the set up of the Store Procedures. Every time we try to modify an existing stored procedure it attempts to save it as an SQL file, unlike in 2000 where it saved it as part of the database itself.
Thank you in advance for any help on this matter
View 1 Replies
View Related
Oct 28, 1999
I wrote a stored procedure with three variables to be passed as input parameters. The stored procedure runs a select into statement into a temp table. The resulting temp table with another table was queried using right outer join to produce the desired results.
The stored procedure compiles error free.However when I ran the stored procedure with the parameters(3) in ISQL/W (SQL Server 6.5) the headers(column-names) were displayed but no records.
When runned as a query with the same parameter values, records were produced.
Help please urgent.
Regards
Olutimi Ooruntoba
View 2 Replies
View Related
Mar 3, 2007
I am trying to raise an event using sp_trace_generateevent in my activation stored proc. (dbo.ActivationSP)
EXEC sp_trace_generateevent @event_class = 82, @userinfo = N'Test Event'
There is a Service broker service listening to this event.
The problem is the event is getting fired whenever the activation SP is executed (could see in profiler) but the secondtargetqueue doesnt receive any messaages.
But if manually do a "EXEC sp_trace_generateevent", the secondtargetqueue receives a messaage.
Both the queues and sevices are in the same database.
The following are the code snippets
-- Code for queue on which the activation is working
CREATE QUEUE TargetQueue WITH STATUS=ON, ACTIVATION (PROCEDURE_NAME = dbo.ActivationSP,MAX_QUEUE_READERS = 5,Execute AS 'dbo') ;
Create Service ReceiverService ON QUEUE TargetQueue (SampleContract)
-- Code for Queue listening to event
Create Queue SecondTargetQueue WITH status= ON
Create Service SecondReceiverService ON QUEUE SecondTargetQueue ([http://schemas.microsoft.com/SQL/Notifications/PostEventNotification])
CREATE EVENT NOTIFICATION TestNotification
ON SERVER FOR UserConfigurable_0 TO SERVICE 'SecondReceiverService', 'current database'
View 3 Replies
View Related
Nov 6, 2007
Using SQL 2005, SP2. All of a sudden, whenever I create any stored procedures in the master database, they get created as system stored procedures. Doesn't matter what I name them, and what they do.
For example, even this simple little guy:
CREATE PROCEDURE BOB
AS
PRINT 'BOB'
GO
Gets created as a system stored procedure.
Any ideas what would cause that and/or how to fix it?
Thanks,
Jason
View 16 Replies
View Related
Dec 16, 2004
Hi
How Can I Generating wrapper code for SQL Server Stored Procedure ??
If You will Go To The Following link you will see an example for Generating wrapper code for Oracle Database .. And Also the author say there is built in tool for Generating wrapper code for SQL Server
http://www.codeproject.com/vb/net/OracleSPWrapper.asp
my question .. where is this tools ???
and thanks with my regarding
Fraas
View 1 Replies
View Related
Apr 1, 2008
I have a stored procedure that is pulling 3 parameters: @user_id, @, begin_date and @end_date. The parameters are setup in the 'parameters' tab of the data set, and also the 'report parameters', however, when I go to run report, I get textbox for user_id, instead of a drop down with pick list.
I tried creating a separate dataset to bring in user_id's only and manually create a parameter for it in 'report parameters'. I then get a drop down box with repeating data, and when I run the report, I get back all user_id's instead of the one I chose.
I'm finding the parameters are the most difficult concept within RS. Does anyone know I can make this work?
Thanks!
View 1 Replies
View Related
Dec 12, 2007
Hi
I was wondering if it was possible to call reporting server web service directly from my sql server stored procedure. The call that I need to make to reporting web service needs to generate the report in a PDF format.
View 1 Replies
View Related
Apr 29, 2008
How do I search for and print all stored procedure names in a particular database? I can use the following query to search and print out all table names in a database. I just need to figure out how to modify the code below to search for stored procedure names. Can anyone help me out?
SELECT TABLE_SCHEMA + '.' + TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
View 1 Replies
View Related
Jun 13, 2007
Seems like I'm stealing all the threads here, : But I need to learn :) I have a StoredProcedure that needs to return values that other StoredProcedures return.Rather than have my DataAccess layer access the DB multiple times, I would like to call One stored Procedure, and have that stored procedure call the others to get the information I need. I think this way would be more efficient than accessing the DB multiple times. One of my SP is:SELECT I.ItemDetailID, I.ItemDetailStatusID, I.ItemDetailTypeID, I.Archived, I.Expired, I.ExpireDate, I.Deleted, S.Name AS 'StatusName', S.ItemDetailStatusID, S.InProgress as 'StatusInProgress', S.Color AS 'StatusColor',T.[Name] AS 'TypeName', T.Prefix, T.Name AS 'ItemDetailTypeName', T.ItemDetailTypeID FROM [Item].ItemDetails I INNER JOIN Item.ItemDetailStatus S ON I.ItemDetailStatusID = S.ItemDetailStatusID INNER JOIN [Item].ItemDetailTypes T ON I.ItemDetailTypeID = T.ItemDetailTypeID However, I already have StoredProcedures that return the exact same data from the ItemDetailStatus table and ItemDetailTypes table.Would it be better to do it above, and have more code to change when a new column/field is added, or more checks, or do something like:(This is not propper SQL) SELECT I.ItemDetailID, I.ItemDetailStatusID, I.ItemDetailTypeID, I.Archived, I.Expired, I.ExpireDate, I.Deleted, EXEC [Item].ItemDetailStatusInfo I.ItemDetailStatusID, EXEC [Item].ItemDetailTypeInfo I.ItemDetailTypeID FROM [Item].ItemDetails IOr something like that... Any thoughts?
View 3 Replies
View Related
May 13, 2008
Greetings:
I have MSSQL 2005. On earlier versions of MSSQL saving a stored procedure wasn't a confusing action. However, every time I try to save my completed stored procedure (parsed successfully ) I'm prompted to save it as a query on the hard drive.
How do I cause the 'Save' action to add the new stored procedure to my database's list of stored procedures?
Thanks!
View 5 Replies
View Related
Apr 7, 2006
We recently upgraded to SQL Server 2005. We had several stored procedures in the master database and, rather than completely rewriting a lot of code, we just recreated these stored procedures in the new master database.
For some reason, some of these stored procedures are getting stored as "System Stored Procedures" rather than just as "Stored Procedures". Queries to sys.Objects and sys.Procedures shows that these procs are being saved with the is_ms_shipped field set to 1, even though they obviously were not shipped with the product.
I can't update the sys.Objects or sys.Procedures views in 2005.
What effect will this flag (is_ms_shipped = 1) have on my stored procedures?
Can I move these out of "System Stored Procedures" and into "Stored Procedures"?
Thanks!
View 24 Replies
View Related
Apr 23, 2008
Hello friends......How are you ? I want to ask you all that how can I do the following ?
I want to now that how many ways are there to do this ?
How can I call one or more stored procedures into perticular one Stored Proc ? in MS SQL Server 2000/05.
View 1 Replies
View Related
Mar 26, 2008
Hello
I'm start to work with SSIS.
We have a lot (many hundreds) of old (SQL Server2000) procedures on SQL 2005.
Most of the Stored Procedures ends with the following commands:
SET @SQLSTRING = 'SELECT * INTO ' + @OutputTableName + ' FROM #RESULTTABLE'
EXEC @RETVAL = sp_executeSQL @SQLSTRING
How can I use SSIS to move the complete #RESULTTABLE to Excel or to a Flat File? (e.g. as a *.csv -File)
I found a way but I think i'ts only a workaround:
1. Write the #Resulttable to DB (changed Prozedure)
2. create data flow task (ole DB Source - Data Conversion - Excel Destination)
Does anyone know a better way to transfer the #RESULTTABLE to Excel or Flat file?
Thanks for an early Answer
Chaepp
View 9 Replies
View Related
Nov 20, 2007
Hi,
Why does the below not return any results???
Colorcodes mark the related keys.
Thanks.
Tables:
FundClient (ClientID PK, Client)
FundPortfolio (PortfolioID PK, Portfolio, ClientID FK)
Staff(StaffID PK, SeniorMgr, ClientID FK, FundID FK)
myLegal(myID PK, LegalCounsel FK, ClientID FK, FundID FK)
FullLegalList(LegalID PK, LegalName)
Code Block
@LegalCounsel int = 0,
@ClientID int = 0,
@FundID int = 0
DECLARE @thisQuery as varchar(max)
SET @thisQuery = 'SELECT p.Portfolio, SeniorMgr, fl.Legal FROM FundClient f'
BEGIN
SET @thisQuery = @thisQuery + ' INNER JOIN FundPortfolio p
ON p.ClientID = f.ClientID'
END
BEGIN
SET @thisQuery = @thisQuery + ' LEFT OUTER JOIN Staff s
ON (s.ClientID = p.ClientID AND s.FundID = p.PortfolioID AND s.ClientID = f.ClientID)'
END
BEGIN
SET @thisQuery = @thisQuery + ' LEFT OUTER JOIN myLegal l
ON (l.ClientID = p.ClientID AND l.FundID = p.PortfolioID)
INNER JOIN FullLegalList fl
ON fl.LegalID = l.LegalCounsel'
END
BEGIN
IF @Legal != 0
SET @thisQuery3 = @thisQuery3 + ' WHERE rl.Legal = ' + cast(@LegalCounsel as varchar(11))
END
BEGIN
IF @ClientID != 0
SET @thisQuery = @thisQuery + ' AND p.ClientID = ' + cast(@ClientID as varchar(11))
END
BEGIN
IF @FundID != 0
SET @thisQuery = @thisQuery + ' AND p.PortfolioID = ' + cast(@FundID as varchar(11))
END
BEGIN
SET @thisQuery = @thisQuery + ';'
END
View 12 Replies
View Related
Jul 18, 2006
Hi All,
I have read the various posts regarding the thread abort issue.
I have a stored proc (CLR-C#) which makes and ldap call to a novell NDS tree and attempts to pull about 40k+ records which I would then insert into a sql server database.
I have set up all the requrements in terms of clr enabled etc...
I have written my class and I can run the sp when I limit the records returned. However when I go to grab all the records, (which takes some time), the sp craps out with the error message in the title of this post.
The assembly is running under unsafe permissions.
If I run the sp once, it works, then again and I may or may not get an 6522 (memory error). I added the search parameter to break down the records returned (so I return a's then b's etc...) . BTW: This works fine ouside SQL Server, I can run this as an ASP.Net app (I prototyped it with a test harness aspx page).
Basically what the class does is
connect to novel nds directorypull records based on search criteria (blank for all)dump records into datatableserialize datatable to xmlcall another sp to take xml and insert into tabledisconnect from treeAny comments/suggestions apreciated.
Thanks,
Stephen
Here is the class (editied to protect privacy):
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using Microsoft.SqlServer.Server;
using Novell.Directory.Ldap;
namespace EDSPullInSQLStoreProc
{
public class EDSPROC
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void EDSPull(bool IsProd, bool IsSecure, string searchParam)
{
//variable declarations
string __LADPHost_DEV = "xx.xx.xx.xx";
string __LADPHost_PROD = "xx.xx.xx.xx";
int __LADPPort_NonSecure = xxx;
int __LADPPort_Secure = xxx;
int __LDAPPort;
string __LDAPUserDN_DEV = "some string";
string __LDAPUserDN_PROD = "somestring";
string __LDAPUserDNPwd_DEV = "apassword";
string __LDAPUserDNPwd_PROD = "apassword";
LdapConnection oLDAPConn;
DataTable oDTEDSData = new DataTable("EDSUSER");
string strErrResponseMsg = "";
SqlPipe oSQLPipe = SqlContext.Pipe;
//connect to eds
try
{
oLDAPConn = new LdapConnection();
if (IsSecure)
{
oLDAPConn.SecureSocketLayer = true;
__LDAPPort = __LADPPort_Secure;
}
else
{
oLDAPConn.SecureSocketLayer = false;
__LDAPPort = __LADPPort_NonSecure;
}
if (IsProd)
{
oLDAPConn.Connect(__LADPHost_PROD, __LDAPPort);
oLDAPConn.Bind(__LDAPUserDN_PROD, __LDAPUserDNPwd_PROD);
}
else
{
oLDAPConn.Connect(__LADPHost_DEV, __LDAPPort);
oLDAPConn.Bind(__LDAPUserDN_DEV, __LDAPUserDNPwd_DEV);
}
}
catch (LdapException ldapEx)
{
oSQLPipe.Send("Error connecting to EDS: " + ldapEx.LdapErrorMessage.ToString());
return;
}
if (oLDAPConn != null)
{
oDTEDSData.Columns.Add("LastName");
...a bunch more columns
DataRow oRow;
//make the ldap query filling the datatable
LdapSearchConstraints oEDSSearchConstriants = new LdapSearchConstraints();
oEDSSearchConstriants.MaxResults = 0;
LdapSearchResults oEDSSearchResults = oLDAPConn.Search("somestring", LdapConnection.SCOPE_ONE, "cn=" + searchParam + "*", null, false, oEDSSearchConstriants);
LdapEntry oEDSEntry;
LdapAttribute oEDSAttrib;
while (oEDSSearchResults.hasMore())
{
try
{
oEDSEntry = oEDSSearchResults.next();
}
catch (LdapException e)
{
oSQLPipe.Send("EDS Pull error: Obtaining next record - " + e.LdapErrorMessage.ToString());
try
{
oLDAPConn.Disconnect();
}
catch
{
oLDAPConn = null;
}
return;
}
oRow = oDTEDSData.NewRow();
oEDSAttrib = oEDSEntry.getAttribute("sn");
if (oEDSAttrib != null)
{
oRow["LastName"] = oEDSAttrib.StringValue;
}
else
{
oRow["LastName"] = "";
}
...get more attributes etc
}//end while
if (oDTEDSData.Rows.Count > 0)
{
try
{
TextWriter oWriter = new StringWriter();
oDTEDSData.WriteXml(oWriter);
string strXML = oWriter.ToString();
strXML = strXML.Replace("'", "''");
using (SqlConnection oConn = new SqlConnection("context connection=true"))
{
oConn.Open();
SqlCommand oCmd = new SqlCommand("exec proc_BulkInsertEDSUsers '" + strXML + "','" + searchParam + "'", oConn);
oCmd.ExecuteNonQuery();
oSQLPipe.Send("EDS Pull complete.");
}
}
catch (Exception ex)
{
oSQLPipe.Send("An error has occurred. " + ex.Message.ToString() + "" + ex.InnerException.Message.ToString());
try
{
oLDAPConn.Disconnect();
}
catch
{
oLDAPConn = null;
}
return;
}
}
//close the ldap connection
try
{
oLDAPConn.Disconnect();
}
catch
{
oLDAPConn = null;
}
}
}
}
}
View 9 Replies
View Related
Jun 16, 2007
Hi,
Do you know how to write stored procedures inside another stored procedure in MS SQL.
Create procedure spMyProc inputData varchar(50)
AS
----- some logical
procedure spMyProc inputInsideData varchar(10)
AS
--- some logical
--- go
-------
View 5 Replies
View Related
May 8, 2008
I am writing a set of store procedures (around 30), most of them require the same basic logic to get an ID, I was thinking to add this logic into an stored procedure.
The question is: Would calling an stored procedure from within an stored procedure affect performance? I mean, would it need to create a separate db connection? am I better off copying and pasting the logic into all the store procedures (in terms of performance)?
Thanks in advance
John
View 5 Replies
View Related
Aug 7, 2007
I wrote a Stored Procedure spMultiValue which takes Multi Value String Parameter "Month". The stored procedure uses a function which returns a table. when I Execute the stored procedure from SQL Server 2005 with input "January,February,March" everything works fine.
In the dataset , I set command type as Text and typed the following statement.
EXEC spMultiValue " & Parameters!Month.Value &"
its not returning anything.
can anyone tell me how to pass multivalue parameter to stored procedure.
Thanks for your help.
View 2 Replies
View Related
Feb 12, 2008
What is the best way to design this stored procedure for speed?
I want to pass in a list of IDs and have a return value of a table that contains the ID and its associated value. Is there a way to pass in as table and come out as table?
input parameter
ID
0
1
2
return value
ID, CurrentDue, PastDue
0, 100, 0
1, 100, 100
2, 123, 0
View 11 Replies
View Related
Nov 1, 2007
Hi all - I'm trying to optimized my stored procedures to be a bit easier to maintain, and am sure this is possible, not am very unclear on the syntax to doing this correctly. For example, I have a simple stored procedure that takes a string as a parameter, and returns its resolved index that corresponds to a record in my database. ie
exec dbo.DeriveStatusID 'Created'
returns an int value as 1
(performed by "SELECT statusID FROM statusList WHERE statusName= 'Created')
but I also have a second stored procedure that needs to make reference to this procedure first, in order to resolve an id - ie:
exec dbo.AddProduct_Insert 'widget1'
which currently performs:SET @statusID = (SELECT statusID FROM statusList WHERE statusName='Created')INSERT INTO Products (productname, statusID) VALUES (''widget1', @statusID)
I want to simply the insert to perform (in one sproc):
SET @statusID = EXEC deriveStatusID ('Created')INSERT INTO Products (productname, statusID) VALUES (''widget1', @statusID)
This works fine if I call this stored procedure in code first, then pass it to the second stored procedure, but NOT if it is reference in the second stored procedure directly (I end up with an empty value for @statusID in this example).
My actual "Insert" stored procedures are far more complicated, but I am working towards lightening the business logic in my application ( it shouldn't have to pre-vet the data prior to executing a valid insert).
Hopefully this makes some sense - it doesn't seem right to me that this is impossible, and am fairly sure I'm just missing some simple syntax - can anyone assist?
View 1 Replies
View Related