Reputation: 29064
I am trying to run a query in SQL Server 2008. It looks like this:
IF EXISTS (SELECT name FROM sysobjects WHERE name = "Bonds" AND type = 'U')
DROP table Bonds
GO
When I run this, I get this error:
Msg 207, Level 16, State 1, Line 2
Invalid column name 'Bonds'.
Msg 28102, Level 16, State 1, Line 3
This query was created by SQL Server. I am trying to run it in a different computer. Then I face this issue.
I have tried Ctrl+Shift+R as this post: SQL Server Invalid Column name after adding new column. But it is not helping.
Need some guidance on this.
Upvotes: 0
Views: 422
Reputation: 16958
I think you can also use
SET QUOTED_IDENTIFIER OFF;
before your query.
Upvotes: 0
Reputation: 460138
Change
WHERE name = "Bonds"
to
WHERE name = 'Bonds'
Otherwise "Bonds"
is treated like a column-name which does not exist.
Upvotes: 3