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
 [SOLVED] Reading CSV thru SELECT...

Author  Topic 

jaggyan
Starting Member

5 Posts

Posted - 2009-07-02 : 03:51:28
Hi All,

I am new to SQL server and would like to know is there an equivalent in SQL server to External Table as in Oracle.

My requirement is, I have a CSV file in the file system of SQL SERVER box. And would like to read this file thru select statement.

Is it possible.

Also, I appreciate if you can post some links related to the documentation of SQL SERVER.

Thanks in Advance
Jaggyam

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-07-02 : 04:14:00
1 Openrowset
2 Bulk insert to table

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jaggyan
Starting Member

5 Posts

Posted - 2009-07-02 : 04:47:15
Thanks for the quick response.

Can I have some sample code.

Thanks in Advance,
Jaggyam
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-07-02 : 05:24:11
select * from OPENROWSET('Microsoft.Jet.OLEDB.4.0','text;HDR=no;FMT=FixedLength;Database=drivename:\', filename#csv)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jaggyan
Starting Member

5 Posts

Posted - 2009-07-02 : 07:31:44
Thanks again. That was a wonderful example.

Thanks,
Jaggyam
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-07-02 : 08:34:45
quote:
Originally posted by jaggyan

Thanks again. That was a wonderful example.

Thanks,
Jaggyam


You are welcome

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -