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
 General SQL Server Forums
 New to SQL Server Programming
 Fast insert

Author  Topic 

pazzy11
Posting Yak Master

145 Posts

Posted - 2008-02-14 : 09:42:19
If I have a table with one column
and i want to insert a few 100's rows of names
I can't use the INSERT stmt as that does one row at a time ,
how can i achieve this ?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-02-14 : 09:51:18
What is the source for these name values? Are they contained in CSV or Excel file?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

pazzy11
Posting Yak Master

145 Posts

Posted - 2008-02-14 : 09:54:38
TEXT, i am trying
[CODE]
INSERT into table
values ( 'djskjk',
'dhsjdhsj',
'dksjkd',
.
.

)
[/CODE]

this wont work, however i could put them into a CSV or excel file ..
is this easier and if so what do i do ?
DTS ?
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-02-14 : 09:57:06
You can use either BCP or Bulk Insert, but frankly I don't think 100 rows are worth this exercise.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2008-02-14 : 10:23:48
insert into table
select 'djskjk' as name
union all select 'dhsjdhsj'
union all select 'dksjkd'
union all ....

Jay
to here knows when
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-02-14 : 11:44:16
BULK INSERT MyTable
FROM 'c:\myfile.txt'
WITH
(
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '\n'
)

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page
   

- Advertisement -