azsxdc zxcvb
azsxdc zxcvb

Reputation: 13

Stored procedure in SQL - change output

I have a report which will pull the data from this stored procedure

-- Insert statements for procedure here
SELECT Empname
FROM  EmpComp

UNION

SELECT ('NULL') AS Empname

The values are returned correctly. But dropdownlist is showing NULL in the middle of other datas.I want NULL as first value in the drop downlist(so that easy for selecting).This stored prcedure is connected to a dataset(in report) which have one parameter (Empname).

How can I amend above code for that? Thanks

Upvotes: 0

Views: 124

Answers (1)

Nikhil Vartak
Nikhil Vartak

Reputation: 5117

This works :) Idea is to select Empname with NULL keyword on top and then transform values to string types.

select case when Empname is null then 'NULL' else Empname end 
from
(
    select null as Empname
    union
    select Empname from EmpComp
) a

Upvotes: 1

Related Questions