2014-04-10 62 views
0

我有以下查詢在bcp命令過去了,命令不是由於多個查詢如何BCP命令的SQL Server添加多個查詢

bcp " SET NOCOUNT ON;IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[primaryKeys]') AND type in (N'U'))  SELECT primary_key_name,[schema_name],table_name,column_name,successfully_removed ,successfully_readded,alter_command_drop ,alter_command_add FROM primaryKeys" c:\Testing.xls -c -STest -dMydb -Usa -PPassword1 

執行請幫

回答

0

你錯過了queryout選項:

bcp "SET NOCOUNT ON;IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[primaryKeys]') AND type in (N'U'))  SELECT primary_key_name,[schema_name],table_name,column_name,successfully_removed ,successfully_readded,alter_command_drop ,alter_command_add FROM primaryKeys" quryout c:\Testing.xls -c -STest -dMydb -Usa -PPassword