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
 Insert a RAW Data to a Table with selected columns

Author  Topic 

NewSQLMember
Starting Member

15 Posts

Posted - 2009-06-27 : 02:17:32
Hi,

Anyone can help me, on how to insert a RAW Data to a Table with selected columns. I need only the Column1 and Column3 to be inserted. Thanking you.

TextFile : RawData.CSV
----------------------
Column1,Column2,Column3
1111111,AAAAAA,BBBBBBB
2222222,AAAAAA,BBBBBBB
3333333,XXXXXX,CCCCCC

Table : RAWDATA
-----------------
Column1 int,
Column2 varchar(10),
Column3 varchar(10),


Regards,
NewSQLMember

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-27 : 03:08:28
You can use a format file with either BULK INSERT or BCP.
There are examples of this in Books Online.


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-27 : 03:26:11
http://www.nigelrivett.net/SQLTsql/BCP_quoted_CSV_Format_file.html
Go to Top of Page

NewSQLMember
Starting Member

15 Posts

Posted - 2009-06-27 : 03:50:55
visakh16,

Thank you very much, not it works.

Regards,
NewSQLMember
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-28 : 00:52:03
welcome
Go to Top of Page
   

- Advertisement -