Why is this SQL Update failing (“column name is no

2019-03-05 03:28发布

问题:

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