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 at a time

Author  Topic 

ankur_gurha
Starting Member

20 Posts

Posted - 2006-08-29 : 10:26:30

Hi,

How do u do something like this


INSERT INTO #Srvname
( Srvcode , CodeName )
Values
( 622773258760115409 , 'Consultancy' ),
( -8112270479827337889 , 'Cross Cultural Training'),
( 4054511778913267481 , 'Departure'),
( -3963967039857539357 , 'Departure'),
( 2058088933942448396 , 'Education')

I am trying to insert multiple values in the temp table in a same statement.. can by any chance we can do this is sql.

Cheers,
A..

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-08-29 : 10:32:09
INSERT INTO #Srvname
( Srvcode , CodeName )
select 622773258760115409 , 'Consultancy' union all
select -8112270479827337889 , 'Cross Cultural Training' union all
select 4054511778913267481 , 'Departure' union all
select -3963967039857539357 , 'Departure' union all
select 2058088933942448396 , 'Education'

Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-08-29 : 10:41:58
Note that "Values" is used in an Insert statement, to insert a single record.

May be, this can made more simpler, if u tell us what is the data source
eg. if data is coming from a table, u can do a select query


Srinika
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-08-29 : 12:01:40
If you try to insert data to temp table from other table then

Insert into #temp(columns)
Select columns from OtherTable

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -