Solved

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

Posted on 2013-11-14
3
242 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

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…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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.

632 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