April 7, 2009 at 8:12 am
Hi,
I have a csv which is generated every day with 50 cols and 50000 rows.
I want only selected col values, which i want to insert in a table.
Is it possible using Bulk insert or BCP? How? Can you people mention the code please?
Note: we cant use SSIS/DTS
Thanks
smeet
April 7, 2009 at 8:23 am
Take a look at OpenRowSet in Books Online. You can use that to query CSV files, text files, etc.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
April 7, 2009 at 8:31 am
Hi Grass
I normally use create table and import it using OPENDATASOURCE.
(SAMPLE)
INSERT INTO IMPORTDATA
SELECT *
FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data Source=[File location]\;Extended Properties="Text;HDR=No;FMT=Delimited"')...TEXT#csv (your csv filename, replace the . with a #)
April 7, 2009 at 9:52 am
Hi
Check out the below link
http://www.dotnetvj.com/2009/03/load-text-or-csv-file-data-into-sql.html
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply