我在bcp命令中传递了以下查询,并且由于多个查询而未执行该命令
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 :(得分: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