Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the following problems

while I am Counting the no. of columns in a table I wrote the query as

select count(*)[No.OF Columns]  from information_schema.columns where table_name='<table_name>' </table_name>


It is running fine but when I write <dbo.table_name> instead of <table_name>

no of columns is becoming 0 as the database tables are stored like dbo.<table_name>

why?
Posted
Updated 17-Oct-11 2:45am
v2

dbo means database object.. it is a prefix to all ur objects. it is not a part ur table name.

u should write like below
SQL
select count(*)[No.OF Columns]  from information_schema.columns
where table_name='tableName'


insted
SQL
select count(*)[No.OF Columns]  from information_schema.columns
where table_name='dbo.tablename'
 
Share this answer
 
The dbo is the owner prefix it is not part of the table name.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900