| Author |
Topic |
|
kashyap_sql
Posting Yak Master
174 Posts |
Posted - 2010-09-30 : 01:56:55
|
how can i insert bulk values at a time ex:- i had a table custid and the table consists of single column i,e custid 1 to 100 table i want to insert all the values at time how can it be done With RegardsKashyap M |
|
|
EugeneLim11
Posting Yak Master
167 Posts |
Posted - 2010-09-30 : 03:17:45
|
| Declare @count intSet @count = 0 while @count < 100 begin Insert into Custid (custid) values (@count) @count = @count + 1 endGO |
 |
|
|
kashyap_sql
Posting Yak Master
174 Posts |
Posted - 2010-09-30 : 03:24:33
|
| thanks EugeneLim11 for your reply but it is showing a error @countWith RegardsKashyap M |
 |
|
|
EugeneLim11
Posting Yak Master
167 Posts |
Posted - 2010-09-30 : 03:28:42
|
| Oops. Forget to use the word SETDeclare @count intSet @count = 1 while @count < 101begin Insert into Custid (custid) values (@count) Set @count = @count + 1 endGO |
 |
|
|
kashyap_sql
Posting Yak Master
174 Posts |
Posted - 2010-09-30 : 03:35:34
|
| that's nice query it works very nicely cheers to YOUWith RegardsKashyap M |
 |
|
|
kashyap_sql
Posting Yak Master
174 Posts |
Posted - 2010-09-30 : 03:42:26
|
if you don't mind can i ask you another question that is just i would like to see the result in horizontal view such as custid 1. 2. 3. 4. 5. 6. 7. .......100 is it possible ???plz if you can With RegardsKashyap M |
 |
|
|
lazycoder
Starting Member
12 Posts |
Posted - 2010-09-30 : 04:06:24
|
try this:declare @res varchar(8000)SET @res = ''SELECT @res = @res + ' ' + convert(varchar(50), custid) FROM CustidSELECT @res |
 |
|
|
kashyap_sql
Posting Yak Master
174 Posts |
Posted - 2010-09-30 : 04:25:47
|
| hey coder the table name is custid and it has a column name is custid and the column has values from 1 to 100 this is the structure of the tableWith RegardsKashyap M |
 |
|
|
EugeneLim11
Posting Yak Master
167 Posts |
|
|
kevlangdo
Starting Member
5 Posts |
|
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2010-09-30 : 06:51:47
|
| pivot function |
 |
|
|
kashyap_sql
Posting Yak Master
174 Posts |
Posted - 2010-10-01 : 00:44:14
|
| sorry for the delay in postingexactly i am trying to learn about pivoting and i am using sql 2005 serverWith RegardsKashyap M |
 |
|
|
|