May 31, 2010 at 10:13 pm
i executed this querry ......
EXEC xp_cmdshell 'bcp "SELECT * FROM TB_Category " queryout "C:\bcptest.txt" -T -c -t,'
i got the following result
SQLState = 42S02, NativeError = 208
Error = [Microsoft][SQL Native Client][SQL Server]Invalid object name 'TB_Category'.
SQLState = 42000, NativeError = 8180
Error = [Microsoft][SQL Native Client][SQL Server]Statement(s) could not be prepared.
NULL
Thanks in advance
June 1, 2010 at 1:31 am
Try specifying the database name in the query:
SELECT * FROM <database>.<schema>.<table>
-- Gianluca Sartori
June 1, 2010 at 11:25 pm
i excuted the query as follow with Database and schema with quey
EXEC xp_cmdshell 'bcp "SELECT * FROM [DB_SCG] [SHIVA] [TB_Category] " queryout "C:\bcptest.txt" -T -c -t,'
i got the error as follow
SQLState = 42000, NativeError = 102
Error = [Microsoft][SQL Native Client][SQL Server]Incorrect syntax near 'TB_Category'.
SQLState = 42000, NativeError = 8180
Error = [Microsoft][SQL Native Client][SQL Server]Statement(s) could not be prepared.
NULL
June 1, 2010 at 11:36 pm
EXEC xp_cmdshell 'bcp "SELECT * FROM [DB_SCG].[SHIVA].[TB_Category] " queryout "C:\bcptest.txt" -T -c -t,'
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply