Why My Bcp Query Out Not Work In Sql Server?
I'm new in sql server and want to save select query into the csv file using with bcp query out for that purpose write this query: declare @cmd as nchar(50) SET @cmd = 'bcp select
Solution 1:
As you are using queryout your source must be a query.
As a query has got blanks, you have to quote it:
Further more your @cmd nchar(50) is to short and will probably truncate your command.
Try this:
declare@cmdasnchar(500)
SET@cmd='bcp "select * from [behzad].[dbo].[behzad]" queryout "d:\spt_values.dat" -U behbeh -P beh1368421 'EXEC master..XP_CMDSHELL @cmdWith a SELECT * FROM ... query it was easier actually, to use the 3-part-qualified table name together with out instead of a SELECT ... with queryout...
Post a Comment for "Why My Bcp Query Out Not Work In Sql Server?"