为什么此SQL更新失败(“列名无效”)?

时间:2014-08-13 23:55:35

标签: sql sql-update sql-server-ce

我有一个像这样的SQL Server CE表:

enter image description here

...而我正试图像这样更新其单独的记录:

update workTables 
set fileType = "INV"

但我得到了:

enter image description here

为什么?

更新

请参阅相关问题here

2 个答案:

答案 0 :(得分:2)

此处检查Microsoft支持yor错误。 http://support.microsoft.com/kb/825392

这是来自网站:

SYMPTOMS:

When you run a query on a Microsoft SQL Server 2000 Windows CE Edition version 2.0 database, and the query has a column that contains one or more space characters, the query may not be successful. Additionally, you may receive the following error message:
FAILED: select <Column Name> from <Table Name>
Error: 0x80040e14 DB_E_ERRORSINCOMMAND
Native Error: (25503)
Description: The column name is not valid. [,,,Node name (if any),Column name,]
Interface defining error: IID_ICommand
Param. 0: 0
Param. 1: 0
Param. 2: 0
Param. 3:
Param. 4: col1
Param. 5:

RESOLUTION:
To resolve this problem, enclose the column name that contains spaces in quotation marks (" "), and then run the query. For example, you can run the following query, and the query results are displayed successfully:
SELECT "col1 " FROM testtable

答案 1 :(得分:1)

您的查询应该是:

   update [workTables] 
   set [fileType] = 'INV' 

Note: single quotes ^^^^