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.
Author |
Topic |
arthiasha
Starting Member
40 Posts |
Posted - 2012-10-18 : 00:21:53
|
Hi experts,I have a .csv file which i need to import data from it to a table called temp in my db. How do i do bcp in, to import the data to the table.I also created a format file for temp. can i have the syntax atleastThanks in advance |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-10-18 : 00:43:03
|
you've few options1. SSIS export import wizard2. OPENROWSET3. BULK INSERT------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2012-10-18 : 01:10:13
|
You can also do BULK INSERT..........bulk insert YourTableNamefrom 'YourFilePath'with (fieldterminator=',' ,rowterminator='\n')--Chandu |
 |
|
arthiasha
Starting Member
40 Posts |
Posted - 2012-10-18 : 01:46:47
|
Can i have a bcp script to do bulk insert?C:\inetpub\wwwroot\db>bcp temp in .\employee.csv -d mydb -S ACER-PC\SQLEXPRESS -U sa -P sa -t,is my script correct? |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-10-18 : 13:02:00
|
quote: Originally posted by arthiasha Can i have a bcp script to do bulk insert?C:\inetpub\wwwroot\db>bcp temp in .\employee.csv -d mydb -S ACER-PC\SQLEXPRESS -U sa -P sa -t,is my script correct?
Yep...you can first create table and then use syntax likebcp <tablename> in <filepath> -T -cif you're using windows authentication------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|