My dilemma is, I am attempting to use the OPENROWSET to read a text file. The text file is a directory listing of all folders that are contained in the folder "c:\somefolder".
Problem is the file doesn't have any column identifiers since it is just a DIR listing.
How do I correctly write this Query:
SELECT t.FileNumber, o.FileNumber
FROM test.dbo.FileListing AS t RIGHT OUTER JOIN
OpenRowset("???","Driver={Microsoft Text Driver (*.txt; *.csv)};DefaultDir=F:\somefolder\;"
AS o
ON t.FileNumber = o.???
Any ideas?? Or suggestions. I am staying away from Bulk Insert due to the permissions needed. And I can't pass in a delimited query parameter that contains the folder names because I would run over the limit of varchar(8000) (Each folder is 20 chars long).
Are there other avenues that I am missing?
Thanks for the help,
Craig
Problem is the file doesn't have any column identifiers since it is just a DIR listing.
How do I correctly write this Query:
SELECT t.FileNumber, o.FileNumber
FROM test.dbo.FileListing AS t RIGHT OUTER JOIN
OpenRowset("???","Driver={Microsoft Text Driver (*.txt; *.csv)};DefaultDir=F:\somefolder\;"
AS o
ON t.FileNumber = o.???
Any ideas?? Or suggestions. I am staying away from Bulk Insert due to the permissions needed. And I can't pass in a delimited query parameter that contains the folder names because I would run over the limit of varchar(8000) (Each folder is 20 chars long).
Are there other avenues that I am missing?
Thanks for the help,
Craig