Hi,
Env: win2k, mssql 8.00.194, Standard Edition
Please help me to make the following bcp to work.
I want to save RS from store procedure to ascii file, using BCP. The sp creates temporary tables and the final select in sp is exec sp_executesql @.comm.
The following example demonstrates the problem:
declare @.bcpCommand nvarchar(100)
set @.bcpCommand = 'bcp "exec sp_helpdb" queryout "\\kkkk\bcp_dbs.log" -c'
exec master..xp_cmdshell @.bcpCommand
I'm getting the following error:
Password:
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]BCP host-files must contain at least one column
NULL
Thanksdeclare @.bcpCommand nvarchar(100)
set @.bcpCommand = 'bcp "set fmtonly off exec sp_helpdb" queryout "c:\test.txt" -c'
exec master..xp_cmdshell @.bcpCommand|||Damn...who was that (un)masked man??
Very nice...but it's as clear as mud
BOL
Returns only meta data to the client.
Syntax
SET FMTONLY { ON | OFF }
Remarks
No rows are processed or sent to the client as a result of the request when SET FMTONLY is turned ON.
The setting of SET FMTONLY is set at execute or run time and not at parse time.
Permissions
SET FMTONLY permissions default to all users.
Examples
This example changes the SET FMTONLY setting to ON and executes a SELECT statement. The setting causes the statement to return the column information only; no rows of data are returned.
SET FMTONLY ON
GO
USE pubs
GO
SELECT *
FROM pubs.dbo.authors
GO|||Thanks for the replay - it works .
没有评论:
发表评论