简体   繁体   English

指定的令牌太长。 最大长度为128个字符

[英]The token specified is too long. The maximum length is 128 characters

I am creating a data integration tool in C# that will move data from one database then to an intermediary then to the final, I am storing the required Database queries in a SQL CE database, on attempting to insert one of the queries into a table I receive: 我正在用C#创建一个数据集成工具,它将数据从一个数据库移动到一个中介,然后移动到最后,我将所需的数据库查询存储在SQL CE数据库中,试图将其中一个查询插入到表I中接收:

Major Error 0x80040E14, Minor Error 25508 "Myquery" The token specified is too long. 重大错误0x80040E14,次要错误25508“Myquery”指定的令牌太长。 The maximum length is 128 characters. 最大长度为128个字符。 [ Maximum size of token (if known) = 128,Token(if known) = "Some of my query" [令牌的最大大小(如果已知)= 128,令牌(如果已知)=“我的一些查询”

Query: 查询:

update SqlQueries Set Query = "CREATE TABLE [dbo].[ASI_SYBranch](
BranchName char(255),
BranchLogoName char(255),
NoteText TEXT,
BranchID char(30),
Active bit,
CoLocationName char(255),
City char(50),
Country char(2),
State char(50),
CoNoteText TEXT,
CoLocationID char(10),
Warehouse char(10),
LocationName char(255),
TaxRegID char(50),
TaxZoneID char(10),
ShipComplete bit,
LocationID char(10),
SameasMainInfo bit,
BranchAddrLine1 char(50),
BranchAddrLine2 char(50),
BranchCity char(50),
BranchCountry char(2),
BranchState char(50),
BranchPostalCode char(20),
BranchBusinessName char(255),
BranchAttention char(255),
BranchEmail char(255),
BranchWeb char(255),
BranchPhone1 char(50),
BranchPhone2 char(50),
BranchFax char(50),
SameasMainAddr bit,
LocBusinessName char(255),
LocAttention char(255),
LocEmail char(255),
LocWeb char(255),
LocPhone1 char(50),
LocPhone2 char(50),
LocFax char(50),
LocAddrLine1 char(50),
LocAddrLine2 char(50),
LocCity char(50),
LocCountry char(2),
LocState char(50),
LocPostalCode char(20),
DefaultCountry char(2),
AccessRole char(64),
LocTaxRegID char(50),
SalesSub char(30),
ExpenseSub char(30),
FreightSub char(30),
DiscountSub char(30),
CuryGainLossSub char(30),
Description char(60),
CurySymbol char(10),
DecimalPrecision smallint,
BaseCurrencyID char(5),
PhoneMask char(50))
GO" Where RefNum = 3

Table Schema: 表格架构:

RefNum          Int
Description     nvarchar
Query           ntext (I tried nvarchar max also)

I found conflicting articles stating this could/ could not be because of the length of my SQL statement 我发现有冲突的文章说明这可能/不可能是因为我的SQL语句的长度

Questions: 问题:

1. Is this true? 这是真的吗?
2. If so how do I get around it? 2.如果是这样,我该如何解决它?

Answer: 回答:

It ended up being because there where tabs and line breaks within my SQL statements 它最终是因为我的SQL语句中有选项卡和换行符

Sounds like you've got a length limit on a text field in your database. 听起来你对数据库中的文本字段有一个长度限制。 You'll need to break your text up into 128-character long strings, or modify your table's schema to allow longer strings. 您需要将文本分解为128个字符的长字符串,或修改表格的模式以允许更长的字符串。

Can you show us your table schema and an example of the data you're trying to insert? 您能告诉我们您的表架构以及您尝试插入的数据示例吗?

SqlCe is a unicode-only database. SqlCe是一个仅限unicode的数据库。 So if your are using VARCHAR fields, mainly inside CREATE TABLE operations, you must change to the NVARCHAR datatype. 因此,如果您正在使用VARCHAR字段(主要在CREATE TABLE操作中),则必须更改为NVARCHAR数据类型。 Otherwise you can get that error. 否则你可以得到那个错误。

Edit: This is true for CHAR fields as well... 编辑:对于CHAR字段也是如此......

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 以…开头的标识符太长。 最大长度为128 - The identifier that starts with … is too long. Maximum length is 128 该文件解析为太长的路径。 最大长度为260个字符 - The file resolves to a path that is too long. The maximum length is 260 characters Selenium C# drive.PageSource - '太长,或指定路径的组件太长。 - Selenium C# drive.PageSource - 'is too long, or a component of the specified path is too long.' 指定的路径,文件名或两者都太长。 C#Azure聊天机器人错误 - The specified path, file name, or both are too long. C# Azure Chat bot error 无法复制文件指定的文件名太长。 当发布机器人到天蓝色时 - Unable to copy file specified file name is too long. When publishing bot to azure 获取未处理的异常“日志输入字符串太长。 写入事件日志的字符串不能超过32766个字符” - Getting unhandled exception “Log entry string is too long. A string written to the event log cannot exceed 32766 characters” System.UriFormatException:'无效的URI:Uri方案太长。 - System.UriFormatException: 'Invalid URI: The Uri scheme is too long.' 414.请求的URL太长。 网 - 414. The request URL is too long. asp.net 指定的密钥太长; 最大密钥长度为767字节-ASPNet Identity MySQL - Specified key was too long; max key length is 767 bytes - ASPNet Identity MySQL 指定密钥太长; 最大密钥长度为767字节实体框架6中的Mysql错误 - Specified key was too long; max key length is 767 bytes Mysql error in Entity Framework 6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM