Hi,
I am having issues trying to get this to work. I can't really see what the problem with my syntax is:
The error is:
Error = [Microsoft][ODBC SQL Server Driver]Unable to open BCP host data-file
(I have write perms in this directory)
Any ideas?
Thanks much!
I am having issues trying to get this to work. I can't really see what the problem with my syntax is:
Code:
declare @execMe varchar(255)
declare @fileDt varchar(20), @fileName varchar(40)
select @fileDt = convert(varchar, GetDate(), 120)
set @fileDt = substring(@fileDt,1,4)+substring(@fileDt,6,2)+substring(@fileDt,9,2)+substring(@fileDt,12,2)+substring(@fileDt,15,2)+substring(@fileDt,18,2)
set @fileName = 'myFile_' + @fileDt + '.txt'
print @fileName
set @execMe = 'bcp "SELECT * FROM myTable where name = ''Joe'' and id <= 10" queryout "G:\myDir\' + @fileName + '"' + ' -T -c -e "G:\myDir\error.txt"'
print @execMe
The error is:
Error = [Microsoft][ODBC SQL Server Driver]Unable to open BCP host data-file
(I have write perms in this directory)
Any ideas?
Thanks much!