x

I have a report which will pull the data from this stored procedure.But dropdownlist in the report is showing NULL in the middle of other datas(Alphabetical order).I want NULL as first value in the drop downlist(so that easy for selecting)

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 in the report is showing NULL in the middle of other datas(Alphabetical order).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

more ▼

asked Sep 25, 2015 at 08:31 AM in Default

avatar image

shsu
1 1

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

Would need to add in some sort of custom ordering, something like the below

SELECT Empname, ROW_NUMBER() OVER (ORDER BY Empname) AS RowNum FROM EmpComp UNION SELECT ('NULL') AS Empname, 0 AS RowNum ORDER BY RowNum

Then get the parameter to only read the Empname column from the sproc

more ▼

answered Sep 25, 2015 at 09:51 AM

avatar image

anthony.green
2.9k 1 4 6

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x474
x231

asked: Sep 25, 2015 at 08:31 AM

Seen: 171 times

Last Updated: Sep 25, 2015 at 09:51 AM

Copyright 2017 Redgate Software. Privacy Policy