1) I am trying to execute the following in query analyzer. The file c:\converted.txt exists on the server. I am actually logged on the server but get error message "Cannot bulk load. The file "c:\converted.txt" does not exist."
BULK INSERT winpayuncashed FROM 'c:\converted.txt'
WITH (
DATAFILETYPE = 'char',
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
);
GO
2) How can I file path as parameter in the command.
Is the user running this script able to access the location where the file is stored? Most of the times, SQL is running under a system account or a different account than the user logged on to the server, so maybe it's a simple permission issue? Can you try to put the converted.txt file into the same directory where your SQL database resides? And then just use the path "converted.txt" without any absolute path names? It should try to read the file from within the SQL data directory then.
https://www.experts-exchange.com/questions/23037605/Problem-Passing-a-Path-Filename-as-an-Input-Parameter-for-a-Bulk-Insert.html