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 2005 Forums
 Transact-SQL (2005)
 sql server not allowing straight table names

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2012-10-20 : 09:52:21
i use the following style
select * from tbl_customers

when i use teh same style select statement in another serevr, there it is not recognizing the table name, on the below way it is recognising, why is it? dbo. tablename enclosed with square bracket.

select * from dbo.[tbl_customers]


Thanks a lot for the helpful info.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-10-20 : 10:38:50
Are you sure tbl_customers exists under the dbo schema?
Go to Top of Page

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2012-10-20 : 14:56:56
Yes the table exists in the database, why it is only accepting with in square brackets.

i have seen many servers.

all i do is select * from tablename

but here:

select * from dbo.[tablename]

with square bracket only it works.

Thanks.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-10-20 : 17:33:39
quote:
Originally posted by cplusplus

Yes the table exists in the database, why it is only accepting with in square brackets.

i have seen many servers.

all i do is select * from tablename

but here:

select * from dbo.[tablename]

with square bracket only it works.

Thanks.



its not the square brackets that matters. I think important think is "dbo." part
I guess other server your default schema is not dbo which is why it explicitly needs it to add dbo. prefix

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -