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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Basic Syntax issues with table

Author  Topic 

kmcnasty
Starting Member

2 Posts

Posted - 2011-06-07 : 22:58:07
Hey all my first time on these forums. Sorry to ask what seems like a basic question.

i have included the code below. The naming conventions for all tables is dbo.tablename running the query below on any other table seems to be working fine. But it seems as tho because User is a function or varible within SQL it throws a syntax error. I have tried putting the table name in quotations but am starting to get a bit stuck.

Again sorry for asking such a basic question. thanking you in advance.


select * 
from dbo.User

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-06-07 : 23:06:03
you should avoid using reserve word as table name. That will save you 2 characters of typing

enclosed the table name in quote [ table name ]


select *
from dbo.[User]



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

kmcnasty
Starting Member

2 Posts

Posted - 2011-06-07 : 23:08:21
Thank you so much for the quick reply. has resolved the issue.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-06-07 : 23:15:44
you are welcome


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -