Re: How can I Pass an array into a Stored Procedure from Visual Basic?
From: David D Webb (spivey_at_nospam.post.com)
Date: 12/03/04
- Next message: Geneath: "Data Report In VB6 !!!HELP!!!"
- Previous message: DavidM: "VB6 Application Install"
- In reply to: Ian: "How can I Pass an array into a Stored Procedure from Visual Basic?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 3 Dec 2004 13:47:28 -0500
CREATE Procedure sp_test_array
@IDList Varchar(8000)
AS
-- Notes: @IDList must be a comma delimited list of id's
SET NOCOUNT ON
DECLARE @Pos1 Int, @Pos2 Int, @id Int
-- Input value - bracket with commas
SET @IDList = ',' + @IDList + ','
SET @Pos1 = 1
WHILE @Pos1 < Len(@IDList)
BEGIN
SET @Pos2 = Charindex(',' , @IDList , @Pos1 + 1)
SET @id = Convert(Int, Substring(@IDList, @Pos1 + 1, @Pos2 - @Pos1 - 1))
PRINT @id
SET @Pos1 = @Pos2
END
- Next message: Geneath: "Data Report In VB6 !!!HELP!!!"
- Previous message: DavidM: "VB6 Application Install"
- In reply to: Ian: "How can I Pass an array into a Stored Procedure from Visual Basic?"
- Messages sorted by: [ date ] [ thread ]