I have the following code:-
declare @cmd varchar(1000)
set @cmd = 'BCP ' + '"Operating.dbo.Mobile"' + ' out '
+ 'jingl1.txt' +' -c -S '+ @@servername + ' -Uxxx -Pxxx'
exec master..xp_cmdshell @cmd
which works fine however after reading BOL I tried putting a select Statement
declare @cmd varchar(1000)
set @cmd = 'BCP ' + '"Select * from Operating.dbo.Mobile"' + ' out '
+ 'jingl1.txt' +' -c -S '+ @@servername + ' -Uxxx -Pxxxx'
exec master..xp_cmdshell @cmd
and get the following error
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database requested in login 'Select * from Operating'. Login fails.
I've tried different users but still get the same. has anyone had this b4?
declare @cmd varchar(1000)
set @cmd = 'BCP ' + '"Operating.dbo.Mobile"' + ' out '
+ 'jingl1.txt' +' -c -S '+ @@servername + ' -Uxxx -Pxxx'
exec master..xp_cmdshell @cmd
which works fine however after reading BOL I tried putting a select Statement
declare @cmd varchar(1000)
set @cmd = 'BCP ' + '"Select * from Operating.dbo.Mobile"' + ' out '
+ 'jingl1.txt' +' -c -S '+ @@servername + ' -Uxxx -Pxxxx'
exec master..xp_cmdshell @cmd
and get the following error
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database requested in login 'Select * from Operating'. Login fails.
I've tried different users but still get the same. has anyone had this b4?