0 votes
1 view
in SQL by (20.3k points)

In SQL Server Compact Edition in Visual Studio 2010 (maybe SQL Server and SQL in general, I don't know), this command works:

DELETE FROM foods WHERE (name IN ('chickens', 'rabbits'))

but this command produces an error of Error near identifier f. Expecting OUTPUT.

DELETE FROM foods f WHERE (f.name IN ('chickens', 'rabbits'))

1 Answer

0 votes
by (40.4k points)
edited by

To alias the table name you can use the below code:

DELETE f FROM dbo.foods AS f WHERE f.name IN (...);

According to IIRC, DELETE statement is not strictly ANSI. But, for other query forms such as correlation aliasing is necessary. 

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...