I wanted to insert data in a table from a text file where it is stored in csv format to a sql server table. For that, I am using bulk-insert statement. Now I need to specify the file name in "From" clause. I don't want to use networked locations or local locations over there. I want to upload my text file in the same directory as my executable file and give a relative path to it. Is it possible???
views:
132answers:
1
+1
A:
I don't think so. I just tried
SELECT BulkColumn
FROM OPENROWSET(BULK'files\doesnotexist.txt',SINGLE_BLOB)x;
And looked at it in Process Monitor
And it was looking for C:\WINDOWS\system32\files\doesnotexist.txt
so I think you would need to put in the full path.
Martin Smith
2010-08-02 13:22:00
Thanks for the reply. So can I use Sqlbulkcopy in c# to achieve my objectives then ???
Anant
2010-08-02 13:25:31
Probably - but surely C# must have some command to retrieve the applications current directory that you can just append?
Martin Smith
2010-08-02 13:34:29
okay. Thanks a lot.
Anant
2010-08-02 13:43:10