Monday, March 26, 2012

Query

I have attached the Adventureworks database to SQL Server 2005.

Whenerver I try to run a new query to this database

Ex: select * from sales.customer

I get this error message

Msg 208, Level 16, State 1, Line 1

Invalid object name 'sales.customer'.

I don't know why this is happining?

Hi,

make sure you are deling with the right database (Select db_name()).

Didi you change the default collation ? Seems that you are using a CS Coallation, that means that its case sensity, you can check that by using the query:

SELECT databasepropertyex('Adventureworks','collation')

Select * from Sales.Customer

So I guess, if you *are* connected to the right database, you should be fine using the proper typing of the name (otherwise, if you are feeling not comfortable withthis solution, you could change the collation of the database, by using the statemetn ALTER DATABSE, look in the BOL for more information)

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||Thanks a lot Jenssql

No comments:

Post a Comment