Explore Courses Blog Tutorials Interview Questions
0 votes
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 ( IN ('chickens', 'rabbits'))

1 Answer

0 votes
by (40.7k points)
edited by

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

DELETE f FROM dbo.foods AS f WHERE 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!

30.5k questions

32.5k answers


108k users

Browse Categories