|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, July 06, 2009 12:51 AM
Points: 1,
Visits: 29
|
|
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, FPalero
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, July 24, 2009 2:13 PM
Points: 53,
Visits: 121
|
|
You can bulk insert into a temporary table and then select the columns you desire. Here is an example:
DECLARE @TempTable TABLE ( Column1 INT, Column2 VARCHAR(10), Column2 VARCHAR(10) )
BULK INSERT @TempTable FROM 'Filepath'
SELECT Column1, Column2 FROM @TempTable As an alternative, I believe that you can use a format file to bulk insert directly into your desired table.
|
|
|
|