dbTalk Databases Forums  

Missing information_schema.tables

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Missing information_schema.tables in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Joe Cool
 
Posts: n/a

Default Missing information_schema.tables - 06-24-2010 , 03:03 PM






I have several databases on a SQL2005 server. All were created the
same way, using the SQL Server Management Studio create new database
wizard. On ONE and ONE ONLY of those databases if I try to generate a
list of tables in that database using:

select table_name from information_schema.tables where table_type =
'BASE TABLE' order by table_name

I get the following error:

Invalid object name 'information_schema.tables'.

If I check the list of system views with the object browser, the view
is indeed there.

This works just fine for all of the other databases on the same
server.

Any ideas why I am getting this error?

Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Missing information_schema.tables - 06-24-2010 , 04:36 PM






Joe Cool (joecool1969 (AT) live (DOT) com) writes:
Quote:
I have several databases on a SQL2005 server. All were created the
same way, using the SQL Server Management Studio create new database
wizard. On ONE and ONE ONLY of those databases if I try to generate a
list of tables in that database using:

select table_name from information_schema.tables where table_type =
'BASE TABLE' order by table_name

I get the following error:

Invalid object name 'information_schema.tables'.

If I check the list of system views with the object browser, the view
is indeed there.

This works just fine for all of the other databases on the same
server.

Any ideas why I am getting this error?
It's spelled INFORMATION_SCHEMA.TABLES. Which does not matter in a
database with a case-insensitive collation, but in a database
with a case-sensitive or binary collation it does.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
  #3  
Old   
Joe Cool
 
Posts: n/a

Default Re: Missing information_schema.tables - 06-24-2010 , 09:47 PM



On Jun 24, 4:36*pm, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote:
Quote:
Joe Cool (joecool1... (AT) live (DOT) com) writes:
I have several databases on a SQL2005 server. All were created the
same way, using the SQL Server Management Studio create new database
wizard. On ONE and ONE ONLY of those databases if I try to generate a
list of tables in that database using:

select table_name from information_schema.tables where table_type =
'BASE TABLE' order by table_name

I get the following error:

Invalid object name 'information_schema.tables'.

If I check the list of system views with the object browser, the view
is indeed there.

This works just fine for all of the other databases on the same
server.

Any ideas why I am getting this error?

It's spelled INFORMATION_SCHEMA.TABLES. Which does not matter in a
database with a case-insensitive collation, but in a database
with a case-sensitive or binary collation it does.
I never considered case sensitivity since I never intenionally make a
database in case sensitive mode. But somehow, the database I was
having problems with had been created with the Latin1_General_BIN,
which apparently is case sensitive. Especially since I changed the
query to reference hte view in uppercase it ran. I'm a little confused
as I didn't make the column references to match case.

I changed the collation to SQL_Latin1_General_CP1_CI_AS with Alter
Database and all is well.

Thanks for the prodding.

Reply With Quote
  #4  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Missing information_schema.tables - 06-25-2010 , 06:34 AM



Joe Cool (joecool1969 (AT) live (DOT) com) writes:
Quote:
I changed the collation to SQL_Latin1_General_CP1_CI_AS with Alter
Database and all is well.
I recommend against using that collation, or more generally against
SQL collations in general. They are legacy collations, and there can
be some severe performance problems if you have varchar in your tables,
but you have a client that works with nvarchar by default. This combination
has a performance impact with Windows collations, but they are usually
far less severe.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
  #5  
Old   
Joe Cool
 
Posts: n/a

Default Re: Missing information_schema.tables - 06-25-2010 , 05:13 PM



On Jun 25, 6:34*am, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote:
Quote:
Joe Cool (joecool1... (AT) live (DOT) com) writes:
I changed the collation to SQL_Latin1_General_CP1_CI_AS with Alter
Database and all is well.

I recommend against using that collation, or more generally against
SQL collations in general. They are legacy collations, and there can
be some severe performance problems if you have varchar in your tables,
but you have a client that works with nvarchar by default. This combination
has a performance impact with Windows collations, but they are usually
far less severe.

I was not aware that you could define a database with no collation.
How do I do that?

Reply With Quote
  #6  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Missing information_schema.tables - 06-26-2010 , 05:12 AM



Joe Cool (joecool1969 (AT) live (DOT) com) writes:
Quote:
I was not aware that you could define a database with no collation.
You can't, and I can't say that I said so. What I said is that I recommend
against using SQL collations, and that you are better off using Windows
collation.

You can leave out the COLLATE clause when you create a database, but
then you will inherit the server collation. (Which also should be a
Windows collation.)


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.