Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


supress output in query

supress output in query

supress output in query

I have a query it goes something like the following:

Select 'test folder'

select * from table.

The result set will be like the following:
1 test folder

1 record1
2 record2
3 record3
4 record4

I then need to use a third party product called goanywhere to write the results to a spreadsheet. The issue is It will only write the teat folder to the spreadsheet. Is what I need it to do is skip the 1stt results of test folder and only write the set of record to the spreadsheet, Is there any way to run a select but suppress the output from it.


RE: supress output in query

You only get a result and result window, when executing the query in SQL Server Management Studio from a query window. That's part of how SQL Server Management Studio works, not part of how SQL Server itself and the database engine work.

You use a third party language, be it C#.NET, VB.NET, Powershell, C++, whatever, and connect to SQL Server, Execute a script like your's with two queries, and get back results in whatever form is typical for the frontend programming language you use, eg a datatable or dataset with several datatables...

Seems you're not a developer, then you'll hardly get what you want in one go, but even SQL Server Management Studio itself will allow you to create spreadsheets from result windows and then you may use Excel to combine them.

Bye, Olaf.

RE: supress output in query

You could try something like this:


--Select 'test folder'

select * from table. 

Microsoft SQL Server MVP
My Blogs
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom

RE: supress output in query

gmmastros commenting the select folder out won't work I guess we need to use that.

Olaf, I am actually executing the SQL in a job scheduler but it may invoke SQL server manager behind the scenes to run the SQL. I am not absolutely sure why we need to select that folder prior to running as you are correct I am not actually a developer. Currently the process is ran manually the results copied into a spreadsheet then e-mailed. Is what I am trying to do is automate that process, that's kind of what I do I automate things.

Thank you both for all your help.


RE: supress output in query

SELECT 'test folder' is doing nothing but creating a single row, single column result with the text value 'test folder'. I don't see, that you need that at all. You might look at a script, that's actually not T-SQL, but something else. From what you describe this SELECT is necessary and doing something like changing directory or activating a certain database. But that's not what it does in T-SQL.

That script has two results, not only one, your job may only convert the first result into an excel sheet, then. Skipping it will give you the more essential data.

Bye, Olaf.

RE: supress output in query

Thank you for your help everyone I talked to the users and developer that was only for documentation purposes which I have other ways to document it, thank you.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close