| Author |
Topic |
|
SQLSoaker
Posting Yak Master
169 Posts |
Posted - 2008-12-18 : 10:39:05
|
| Hello,Is it possible to call a stored procedure and have it not print the column headers?exec my_SP @parm1 = 'xxx' @parm2 = 'xxx' |
|
|
hanbingl
Aged Yak Warrior
652 Posts |
Posted - 2008-12-18 : 10:59:45
|
| Since your sp only returns a table convert it to a table function. Then:select header1+'', header2+'' from my_fn(@parm1, @parm2) |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-18 : 11:11:13
|
What? E 12°55'05.63"N 56°04'39.26" |
 |
|
|
SQLSoaker
Posting Yak Master
169 Posts |
Posted - 2008-12-18 : 11:14:42
|
quote: Originally posted by hanbingl Since your sp only returns a table convert it to a table function. Then:select header1+'', header2+'' from my_fn(@parm1, @parm2)
Thank you hanbingl, I've tried this but I am getting an error.set ANSI_NULLS ONset QUOTED_IDENTIFIER ONGOCREATE FUNCTION [dbo].[FUNCTION_AGINGREPORT] (@DATA nvarchar(3), @ACCOUNT nvarchar(200)) RETURNS TABLE AS RETURN EXEC my_SP @dataareaid = @DATA, @accountnum = @ACCOUNTIncorrect syntax near the keyword 'EXEC'.Are you not allowed to call exec in the function?!? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-18 : 11:21:26
|
I am stumped... E 12°55'05.63"N 56°04'39.26" |
 |
|
|
SQLSoaker
Posting Yak Master
169 Posts |
Posted - 2008-12-18 : 11:25:02
|
quote: Originally posted by Peso I am stumped... E 12°55'05.63"N 56°04'39.26"
Peso, I am trying to call my stored procedure without column headers on it. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-18 : 11:56:41
|
Why?What is your objective? E 12°55'05.63"N 56°04'39.26" |
 |
|
|
SQLSoaker
Posting Yak Master
169 Posts |
Posted - 2008-12-18 : 12:27:50
|
quote: Originally posted by Peso Why?What is your objective? E 12°55'05.63"N 56°04'39.26"
I have another stored procedure that calls this one and writes the results to a file and then sends out email with that data. The formatting in the email would look a lot nicer if I were to remove the column headers after the first exec to the stored procedure. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-18 : 12:56:57
|
CREATE TABLE #TempINSERT #Temp EXEC sp1INSERT #Temp EXEC sp2Send mail containing records in #Temp table... E 12°55'05.63"N 56°04'39.26" |
 |
|
|
SQLSoaker
Posting Yak Master
169 Posts |
Posted - 2008-12-18 : 16:07:08
|
quote: Originally posted by Peso CREATE TABLE #TempINSERT #Temp EXEC sp1INSERT #Temp EXEC sp2Send mail containing records in #Temp table... E 12°55'05.63"N 56°04'39.26"
Yes but this will not eliminate the column headers... |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-19 : 00:43:01
|
It will eliminate the second set of column headers. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|