DocumentID = "123" >>>TransactionIDs = "1,2,3,4,5" >>> >>>SQLEXEC("myStoredProc " + m.DocumentID + ", " + m.TransactionIDs)>>>
ALTER procedure [dbo].[uspAssignTransactions] >>> @DepositVoucherID int = null, >>> @TransactionIDs varchar(4000) = null >>>as >>> >>>select ID >>>into #IDs2Assign >>>from CaseTransactions >>>where charindex(',' + ltrim(rtrim(cast(ID as varchar(10)))) + ',', @TransactionIDs) > 0 and >>> DepositVoucherID is null and ClearedForDeposit = 1 >>> >>>update CaseTransactions set DepositVoucherID = @DepositVoucherID where ID in (select ID from #IDs2Assign)>>>
CREATE procedure [dbo].[uspAssignTransactions] > @DepositVoucherID int = null, > @xmlDocument xml >as > >DECLARE @docHandle int; > >EXEC sp_xml_preparedocument @docHandle OUTPUT, @xmlDocument; > >UPDATE CaseTransactions >SET DepositVoucherID = @DepositVoucherID >FROM OPENXML(@docHandle, N'/ROOT/Transactions') > >-- here's where I am lost, how to join? >Frank,
LOCAL lnHandle, cXML, myInQuery TEXT TO myInQuery noshow DECLARE @hDoc int DECLARE @tbl TABLE (pId int) exec sp_xml_preparedocument @hDoc OUTPUT, ?m.cXML INSERT @tbl SELECT * FROM OPENXML(@hDoc, ?m.cNodename, 1) WITH (myid int) EXEC sp_xml_removedocument @hDoc SELECT * FROM [Northwind]..[Products] WHERE ProductID IN (SELECT pID FROM @tbl) ENDTEXT ** Local cursor CREATE CURSOR test (myID i) INSERT INTO test VALUES (1) INSERT INTO test VALUES (3) INSERT INTO test VALUES (5) ** Local cursor CURSORTOXML('test','cXML',2) cNodeName = '/VFPData/test' && CursorToXML by default use VFPData as root, and tablename in lowercase for rows lnHandle = SQLSTRINGCONNECT('Driver={SQL Server Native Client 11.0};server=.\SQLExpress2012;Trusted_Connection=yes') SQLEXEC(m.lnHandle, m.myInQuery, 'result') SQLDISCONNECT(m.lnHandle) SELECT result BROWSEPS: I don't know why even replied here, I visit here very rarely:) Likely I will miss your followup explanations.