Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2013-11-14
3
Medium Priority
?
246 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 2000 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
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…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

886 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