Solved

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

Posted on 2013-11-14
3
238 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
Comment Utility
Why are you debugging it? Just hit F5 (execute).
0
 
LVL 10

Accepted Solution

by:
PadawanDBA earned 500 total points
Comment Utility
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
Comment Utility
Thanks for the quick response and accurate solution.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

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…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now