Solved

SQL Server 2008 error trying to return number of table in a DB

Posted on 2013-11-14
3
239 Views
Last Modified: 2013-11-14
See attachment of error and select statement when trying to return a count of number of tables in a database.
SQLErr.JPG
0
Comment
Question by:bjbrown
3 Comments
 
LVL 2

Expert Comment

by:burdit
ID: 39649057
Why are you debugging it? Just hit F5 (execute).
0
 
LVL 10

Accepted Solution

by:
PadawanDBA earned 500 total points
ID: 39649063
If you're looking for the number of tables in a database, why don't you just use:

use <database_to_count>
go;

select
    count( 1 ) as tableCount
from
    sys.tables;

Open in new window

0
 

Author Closing Comment

by:bjbrown
ID: 39649087
Thanks for the quick response and accurate solution.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
DTS Connection Failed 7 70
SQL Insert parts by customer 12 34
create an aggregate function 9 36
Can > be used for a Text field 6 49
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question