Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenRowSet

Status
Not open for further replies.
Joined
Mar 12, 2003
Messages
678
Location
US
I am trying to connect to a comma delimited text file using OpenRowset, but I can not get the format right. Does anyone have the code and are there other problems that i should be aware of. The file will be accessed using a unc path.
 
try import following text file:

Code:
I am trying to OpenRowset, but I can not get the format right
Does anyone have the code, are there aware of 
The file will be accessed, using a unc path

using this format file:

Code:
9.0
2
1  SQLCHAR  0  40 ","        1  col1        SQL_Latin1_General_Cp437_BIN
2  SQLCHAR  0  40 "\r\n"     2  col2        SQL_Latin1_General_Cp437_BIN

I don't know why I need the first 2 lines, leave to you to explain it ;-)
 
oops, forget the openrowset code

Code:
SELECT a.* FROM OPENROWSET( BULK 'c:\qofd\openrowset\deli.txt', 
   FORMATFILE = 'c:\qofd\openrowset\value.fmt') AS a;
 
Is there better performance using the Bulk?
 
Getting this error:

Incorrect syntax near the keyword 'BULK'.
 

I forgot to mention that I used SQL Server 2005.
 
That's what I thought too. Thanks for the suggestion though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top