JJ5
JJ5

Reputation: 55

inconsistent DB record returns - migrated accessDB to SQL

I have a table in my DB that has 2 bit fields, one called Active and one called Public..For all records Active and Public are both set to 1/true

When my query is

Select Top 1000 * from [NewsStory] WHERE Active = 1

I get all my records

When I change Active to Public it returns nothing...even though I can see all the Public fields displaying true the exact same as the Actives beside them.

Select Top 1000 * from [NewsStory] WHERE Public = 1

Is there something wrong with my DB conversion import? I don't understand at all why Active = 1 works but Public = 1 fails..

Thanks for any help

Upvotes: 2

Views: 60

Answers (1)

Jim Hewitt
Jim Hewitt

Reputation: 1792

Public is a SQL Server reserved word. When you use a column name that is a reserved word you must embed it in brackets. For example, you should be using [Public] in your Select clause.

Upvotes: 2

Related Questions