我想从SQL Server数据库导出整个表。
要求是:
示例行:
$scope.myDate=new Date();
{field:'getValue("weight",myDate)',displayName:'Weight'},
应导出为:
1,some
very
long
value
which might contain a comma,
or a newline, etc...,9,\path\tofile,444,X,,2011-01-01,
我尝试过使用"1","some
very
long
value
which might contain a comma,
or a newline, etc...","9","\path\tofile","444","X","","2011-01-01",
:
BCP
但它不包含带引号的值。
由于
答案 0 :(得分:0)
bcp "select quotename(isnull(col1, \"\"), '\"') as col1 from db.schema.table" queryout TABLENAME.csv -U username -P password -S server -c -t','
不知道你对"长期值的定义"是,但QUOTENAME()
限制为128个字符。如果您需要支持更长时间,请尝试CONCAT()
,或者滚动您自己的功能。对于转义双引号,您也可以尝试使用CHAR(34)。