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
 Transact-SQL (2000)
 multiple inserts

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2002-02-26 : 20:40:43

Is there a simple way to insert 5 values into 5 different rows in a SP?

Or do i Have to have 5 insert statements?

Is there anything wrong speedwise with doing 5 inserts?

thanks

nr
SQLTeam MVY

12543 Posts

Posted - 2002-02-26 : 20:51:54
insert tbl
select 1
union
select 2
union
select 3
...

==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.
Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-02-26 : 20:57:35
Well... you can do this:
insert into table (value)
select 1 as value
union
select 2
union
select 3
union
select 4
union
select 5


but I suspect that's not what you want.....

I 'm guessing (from your question) that you're doing your inserts from ADO - and you'd like some nice easy way to insert multiple records at a time?

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-02-26 : 20:58:35
Gee you gotta be quick around here - sorry nr you beat me to it...

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page
   

- Advertisement -