水滴石穿

渴望成为高手--Amy.Qiu
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

BCP

Posted on 2008-07-03 11:51  AmyQiu  阅读(574)  评论(0编辑  收藏  举报

 

SQL Server BCP 的数据导入导出 
 
导入文本文件 
EXEC master..xp_cmdshell 'bcp dbname..tablename in c:\DT.txt -c -Sservername -Usa -Ppassword' 

导出文本文件 
EXEC master..xp_cmdshell 'bcp dbname..tablename out c:\DT.txt -c -Sservername -Usa -Ppassword'
或 
EXEC master..xp_cmdshell 'bcp "Select * from dbname..tablename" queryout c:\DT.txt -c -Sservername -Usa -Ppassword' 
 

 

cmd

C:\Documents and Settings\Amy.Qiu>bcp gbldb.dbo.master in \\192.168.60.252\ReadW
riteShare\GBLDB_Master\GBLDB_Master.txt -192.168.60.252\SQL2005 --n


SQLState = 37000, NativeError = 1934
Error = [Microsoft][SQL Native Client][SQL Server]INSERT failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'. Verify that SEToptions are correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations.

原因是,某个VIEW的UNIQUE CLUSTERED,删除后导入再重建