| Author |
Topic |
|
born2acheive
Yak Posting Veteran
65 Posts |
Posted - 2006-10-09 : 06:25:26
|
| hi,i want to insert multiple record at a time,for example:in MYSQL we use the following:insert into emp values('karthik',23),('jimmy',28),('billy',46)like wise i want to insert multiple records at a time in sql server,so please give me query to do this ,pleaseeeeeeeeeeeeeeee |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-10-09 : 06:34:41
|
| insert into emp select 'karthik',23 union all SELECT 'jimmy',28 union all SELECT 'billy',46Peter LarssonHelsingborg, SwedenEDIT: Added code in red. |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-10-09 : 06:44:35
|
| insert into emp select 'karthik',23 union all select 'jimmy',28 union all select 'billy',46==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-10-09 : 06:48:01
|
| OMG. How could I forget SELECT?Peter LarssonHelsingborg, Sweden |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-10-09 : 09:15:37
|
quote: Originally posted by born2acheive hi,i want to insert multiple record at a time,for example:in MYSQL we use the following:insert into emp values('karthik',23),('jimmy',28),('billy',46)like wise i want to insert multiple records at a time in sql server,so please give me query to do this ,pleaseeeeeeeeeeeeeeee
Learn SQLhttp://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp MadhivananFailing to plan is Planning to fail |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-10-09 : 10:41:14
|
| >>SELECT @OrderId = OrderId FROM OrdersI always expect it to return error "Query returns more than one value" if there are more than one valueMadhivananFailing to plan is Planning to fail |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2006-10-09 : 10:52:22
|
quote: Originally posted by madhivanan >>SELECT @OrderId = OrderId FROM OrdersI always expect it to return error "Query returns more than one value" if there are more than one valueMadhivananFailing to plan is Planning to fail
Well then you must have a DB2 background-802Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-10-09 : 11:51:46
|
| >>Well then you must have a DB2 backgroundNoMadhivananFailing to plan is Planning to fail |
 |
|
|
|