Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Qry result without column name

Author  Topic 

imrul
Starting Member

36 Posts

Posted - 2009-01-15 : 01:47:14
Hi, I want the result of a query without the column name and
no of rows affected message. That is to say, result of the query

use Northwind
Select CategoryId,CategoryName From dbo.Categories

Shows:

CategoryId CategoryName
----------- ---------------
1 Beverages
2 Condiments
3 Confections
4 Dairy Products
5 Grains/Cereals
6 Meat/Poultry
7 Produce
8 Seafood

(8 row(s) affected)
I need the result like

1 Beverages
2 Condiments
3 Confections
4 Dairy Products
5 Grains/Cereals
6 Meat/Poultry
7 Produce
8 Seafood

Can any one help?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-01-15 : 02:15:30
1 Why do you not want to display column names?
2 Put this at the beginning of the query
SET NOCOUNT ON


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

imrul
Starting Member

36 Posts

Posted - 2009-01-15 : 02:23:52
thanks madhivanan,
I have to run bunch of query and the ultimate result will be comma separated value with only one header.
Business wants the result in txt, but should have an option to open it through excel.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-01-15 : 02:31:26
quote:
Originally posted by imrul

thanks madhivanan,
I have to run bunch of query and the ultimate result will be comma separated value with only one header.
Business wants the result in txt, but should have an option to open it through excel.


Ok. How can eliminating column names solve your problem?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-15 : 07:52:10
quote:
Originally posted by imrul

thanks madhivanan,
I have to run bunch of query and the ultimate result will be comma separated value with only one header.
Business wants the result in txt, but should have an option to open it through excel.


what meaning does it make when you have data in excel without any headers? or are you trying to produce a csv list from the above data?
Go to Top of Page

imrul
Starting Member

36 Posts

Posted - 2009-02-02 : 10:56:29
Hi Visakh, I need a CSV File from the above data.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-02 : 12:21:09
isnt it better to use dts export/import wizard or bcp for this?

http://sqlblogcasts.com/blogs/madhivanan/archive/2007/08/27/bcp-export-data-to-text-file.aspx
Go to Top of Page
   

- Advertisement -