Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
calvin464
Starting Member
11 Posts |
Posted - 2007-06-25 : 13:28:21
|
Hi,I have problem with a passing in a comma delimited string that larger than 8000 characters. Does anyone know a better way to passing large size string than the way I did or do I pretty much have to split the text string into several smaller string for processing? ThanksHere is my stored procedure:CREATE PROCEDURE proc_UpdateGoodBatchTxn@MerchantID VARCHAR(15)=NULL, @ListOfTxnId text=NULL, @BatchIndex VARCHAR(20)=NULL, @BatchNum varchar(50)=NULL, @UserName varchar(20)=NULLASSET NOCOUNT ONSET XACT_ABORT ONBEGIN TRANSACTIONDECLARE @OrderID varchar(10), @Pos int, @TxnID intdeclare @TxnIdList varchar(8000)select @TxnIdList = convert(varchar(8000), @ListOfTxnId)SET @TxnIdList = LTRIM(RTRIM(@TxnIdList))+ ','SET @Pos = CHARINDEX(',', @TxnIdList, 1)IF REPLACE(@TxnIdList, ',', '') <> ''BEGIN WHILE @Pos > 0 BEGIN SET @OrderID = LTRIM(RTRIM(LEFT(@TxnIdList, @Pos - 1))) IF @OrderID <> '' BEGIN SET @TxnID = CAST(@OrderID AS int) Update transactions Set TransactionStatus='Settled', SettlementDate=getdate() Where TransactionID= @TxnID END SET @TxnIdList = RIGHT(@TxnIdList, LEN(@TxnIdList) - @Pos) SET @Pos = CHARINDEX(',', @TxnIdList, 1) ENDEND COMMIT TRANSACTIONGO |
|
Kristen
Test
22859 Posts |
|
|
|
|
|
|