Why is this SQL Update failing (“column name is not valid”)?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 06:15:42

问题


I've got a SQL Server CE table like so:

...and I'm trying to update its solitary record like so:

update workTables 
set fileType = "INV"

Yet I get:

Why?

UPDATE

Please see a related question here


回答1:


Your query should be:

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

Note: single quotes ^^^^



回答2:


Here check Microsoft support for yor error. http://support.microsoft.com/kb/825392

This is from the site:

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


来源:https://stackoverflow.com/questions/25298045/why-is-this-sql-update-failing-column-name-is-not-valid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!