[英]SQL Server bulk insert XML format file with Maximum LENGTH
I want to set the length to MAX for one of my XML fields. 我想将我的XML字段之一的长度设置为MAX。
XML Code: XML代码:
<?xml version="1.0"?>
<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RECORD>
<FIELD ID="1" xsi:type="CharFixed" LENGTH="3" />
<FIELD ID="2" xsi:type="CharFixed" LENGTH="MAXLENGTH" />
<FIELD ID="3" xsi:type="CharFixed" LENGTH="10" />
<FIELD ID="4" xsi:type="CharFixed" LENGTH="8" />
</RECORD>
<ROW>
<COLUMN SOURCE="1" NAME="Field1" xsi:type="SQLNVARCHAR"/>
<COLUMN SOURCE="2" NAME="Field2" xsi:type="SQLNVARCHAR"/>
<COLUMN SOURCE="3" NAME="Field3" xsi:type="SQLNVARCHAR"/>
<COLUMN SOURCE="4" NAME="Field4" xsi:type="SQLNVARCHAR"/>
</ROW>
</BCPFORMAT>
But 'MAXLENGTH' does not seem to work. 但是“ MAXLENGTH”似乎无效。
Error message: 错误信息:
bad value MAXLENGTH for attribute "LENGTH"
Any suggestions on how to put the LENGTH to maximum ? 关于如何将LENGTH最大化的任何建议?
The length of a string is limited to 4000 (nchar) or 8000 (char) type. 字符串的长度限制为4000(nchar)或8000(char)类型。 There is no max length
-constant - AFAIC 没有max length
-常数-AFAIC
Refer to this, "Field Attributes" 参见此“字段属性”
If you look up the schema meta-data just as SQL Server does, you can follow this link 如果您像SQL Server一样查找架构元数据 ,则可以单击此链接
http://schemas.microsoft.com/sqlserver/2004/bulkload/format/bulkloadschema.xsd http://schemas.microsoft.com/sqlserver/2004/bulkload/format/bulkloadschema.xsd
to find this 找到这个
<xsd:attribute name="LENGTH" type="xsd:positiveInteger" use="required"/>
[...]
<xsd:attribute name="MAX_LENGTH" type="xsd:positiveInteger" use="optional"/>
So the length
is required
while max_length
seems to be optional
, but if you specify it, it must be a positive integer. 因此, length
是required
而max_length
似乎是optional
,但是如果指定它,则它必须是一个正整数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.