SQL Print Query

Posted on 2011-10-07
Last Modified: 2012-05-12

Say I want to do an sql query like

SELECT COUNT(ColumnB) FROM table_name

And I want the out to look like:
ColumnB Rows = 56

Is there a way to get the sql statement the return the output in that manner.

Any help would be much appreciated.

Question by:hellworld12345
    LVL 23

    Accepted Solution


    Select 'ColumnB Rows = ' + cast(COUNT(ColumnB) as varchar(10)) From table_name

    Author Closing Comment

    Thank you for your help.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
    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…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    732 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

    22 Experts available now in Live!

    Get 1:1 Help Now