Home All Groups Group Topic Archive Search About

Need to do the following...any suggestions?

Author
3 May 2006 7:30 PM
Ben
i need to be able to run the following code

SELECT NULL, 'N/A', 0
UNION
EXEC spListSubgroupsByGroupID @param

Basically, I need to add an additonal row to the results that enters a null
value.  I cannot change the spListSubgroupsByGroupID stored procedure.

any suggestions?
thanks.

Author
3 May 2006 7:38 PM
Roy Harvey
I think the only way to do this is to use a table.

Create a table that matches the result set returned by the stored
procedure.

INSERT ThatTable VALUES(NULL, 'N/A', 0)

INSERT ThatTable
EXEC spListSubgroupsByGroupID @param

SELECT * FROM ThatTable

Roy Harvey
Beacon Falls, CT

On Wed, 3 May 2006 12:30:02 -0700, Ben <ben_1_ AT hotmail DOT com>
wrote:

Show quote
>i need to be able to run the following code
>
>SELECT NULL, 'N/A', 0
>UNION
>EXEC spListSubgroupsByGroupID @param
>
>Basically, I need to add an additonal row to the results that enters a null
>value.  I cannot change the spListSubgroupsByGroupID stored procedure.
>
>any suggestions?
>thanks.
Author
4 May 2006 12:15 PM
Ben
Thank you for the repsonces.  They both worked.

Show quote
"Roy Harvey" wrote:

> I think the only way to do this is to use a table.
>
> Create a table that matches the result set returned by the stored
> procedure.
>
> INSERT ThatTable VALUES(NULL, 'N/A', 0)
>
> INSERT ThatTable
> EXEC spListSubgroupsByGroupID @param
>
> SELECT * FROM ThatTable
>
> Roy Harvey
> Beacon Falls, CT
>
> On Wed, 3 May 2006 12:30:02 -0700, Ben <ben_1_ AT hotmail DOT com>
> wrote:
>
> >i need to be able to run the following code
> >
> >SELECT NULL, 'N/A', 0
> >UNION
> >EXEC spListSubgroupsByGroupID @param
> >
> >Basically, I need to add an additonal row to the results that enters a null
> >value.  I cannot change the spListSubgroupsByGroupID stored procedure.
> >
> >any suggestions?
> >thanks.
>
Author
3 May 2006 7:40 PM
Aaron Bertrand [SQL Server MVP]
CREATE TABLE #foo
(
    col1 datatype,
    col2 VARCHAR(whatever),
    col3 INT
);

INSERT #foo EXEC spListSubgroupsByGroupID @param;

SELECT col1 = NULL, col1 = 'N/A', col1 = 0
UNION
SELECT col1,col2,col3 FROM #foo;

DROP TABLE #foo;

Show quote
"Ben" <ben_1_ AT hotmail DOT com> wrote in message
news:9889B10F-1F27-4B20-982F-781B6DBD326F@microsoft.com...
>i need to be able to run the following code
>
> SELECT NULL, 'N/A', 0
> UNION
> EXEC spListSubgroupsByGroupID @param
>
> Basically, I need to add an additonal row to the results that enters a
> null
> value.  I cannot change the spListSubgroupsByGroupID stored procedure.
>
> any suggestions?
> thanks.

AddThis Social Bookmark Button