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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Need to use a VECTOR in Stored Procedure

Author  Topic 

dubo
Starting Member

2 Posts

Posted - 2002-08-28 : 17:08:31
HI!
I have 3 values (2,3,4)
and i´m doing this:

INSERT INTO table (code) values (2)
INSERT INTO table (code) values (3)
INSERT INTO table (code) values (4)

How can i use a vector and a repetitive (for, while, etc) function.?

Thanks

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-08-28 : 17:41:58
Not quite sure its what you mean but
 
declare @i int ; set @i = 2
begin tran
while @i<5
begin
insert table(code) values(@i)
set @i=@i+1
end
commit



HTH
Jasper Smith
Go to Top of Page

dubo
Starting Member

2 Posts

Posted - 2002-08-29 : 08:36:02
quote:

Not quite sure its what you mean but
 
declare @i int ; set @i = 2
begin tran
while @i<5
begin
insert table(code) values(@i)
set @i=@i+1
end
commit



HTH
Jasper Smith



but the values can be 8 3 65 22
there arnt conecutive values


Go to Top of Page

jasper_smith
SQL Server MVP &amp; SQLTeam MVY

846 Posts

Posted - 2002-08-29 : 15:44:02
Then you need to explain what you mean by vector. Can you give an example maybe in another programming language ?


HTH
Jasper Smith
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-08-29 : 19:33:54
If you're talking about using an array, then you'll have to research CSV here on SQLTeam to learn ways to parse them. There is no such data type in SQL as an Array, so CSV is probably the closest you'll find. Robvolk has a good article about parsing a CSV and inserting the results into a table at [url]http://www.sqlteam.com/item.asp?ItemID=2652[/url]

Go to Top of Page
   

- Advertisement -