Tuesday, March 27, 2012

Deleting records

Whenever I try to delete records from a table joined to another table, like so:

DELETE [tblTransaction Detail Local] FROM [tblTransaction Detail Local], [tblTransaction Header] WHERE ([tblTransaction Detail Local].[Transaction ID] = [tblTransaction Header].[Transaction ID]) AND ([tblTransaction Header].[Computer ID] = 3)

I get the error:

Major Error 0x80040E14, Minor Error 25501

> DELETE [tblTransaction Detail Local] FROM [tblTransaction Detail Local], [tblTransaction Header] WHERE ([tblTransaction Detail Local].[Transaction ID] = [tblTransaction Header].[Transaction ID]) AND ([tblTransaction Header].[Computer ID] = 3)

There was an error parsing the query. [ Token line number = 1,Token line offset = 38,Token in error = FROM ]

This is an SQL CE database, and SQL Server Management Studio. Any ideas?

You can only refer to a single table in a SQL CE DELETE statement - see http://msdn2.microsoft.com/en-us/library/ms174018.aspxsql

No comments:

Post a Comment