Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Incorrect syntax near the keyword 'File'

Author  Topic 

alan.curtis
Starting Member

2 Posts

Posted - 2008-07-14 : 15:35:24
I am new to MS SQL although I do know a little mysql.

I am trying to use the command line tool sqlcmd and get this error (I am trying to access a database with a table called 'File'.)

I use the query "select * from File"

and get the error

Incorrect syntax near the keyword 'File'

Is this because 'File' is some sort of reserved word? Do I have to quote it?

How do I access the table 'File'?






tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-07-14 : 15:37:16
file is a reserved word, so you must put square brackets around it:
select * from [file]

Avoid using reserved words for all object names.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -