Turn off "Print Column Headers" using T-SQL

Last Post 18 Jun 2008 02:37 AM by SQLUSA. 3 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Huifong
New Member
New Member

--
16 Jun 2008 10:27 PM
I create a report by using the Crystal, which is based on a stored procedure. I need to turn off the 'print column header', which can be easily done in the Query Analyzer, but I don't know the T-sql syntax to put it inside the store procedure.

If I run the stored procedure in the Query Analyzer without turn off the 'Print Column Header' option, the output is
ID Name
xx xxxx

ID Name
yy yyyy

ID Name
zz zzz ............

The crystal report only returns the first two lines including the header line. I need the output is like:

ID Name
xx xxxx
yy yyyy
zz zzzz

To achieve this, I need to turn off the 'Print Column Header' via the T-sql within the stored procedure. Could anyone give some advice please? Thanks in advance !


nosepicker
New Member
New Member

--
17 Jun 2008 08:34 AM
It looks like you're running several SELECT statements within your stored procedure, or running them in a loop/cursor. How about if you insert your results into a temp table and then perform a single SELECT statement from that temp table at the end of the stored procedure?
Huifong
New Member
New Member

--
17 Jun 2008 04:32 PM
Yes, there is a loop within the stored procedure.

I was thinking about the temp table before, but though that if I could do the report straight on the stroed procedure, it would have saved me a lot of work.

Thank you for your input.
SQLUSA
New Member
New Member

--
18 Jun 2008 02:37 AM
You can use #temptable or @tablevariable inside a stored procedure to assemble the result. Both vanish automatically upon exit from the sproc.

Generally set-based operations perform better than looping.

Kalman Toth - Database, Data Warehouse & Business Intelligence Architect
SQL Server 2005 Training, SSAS, SSIS, SSRS: http://www.sqlusa.com/
You are not authorized to post a reply.

Acceptable Use Policy