Order by View
-
13 марта 2012 г. 13:14Situation ..
I need to order the NAME field. But this field has values NULLS.
How can this sort with a VIEW?
[] s
Все ответы
-
13 марта 2012 г. 13:18
-
13 марта 2012 г. 13:27
The problem is this, see the example
Name | Phone
A | 555 555
null | 666666
A | 777 777
B | 555 555This [null] should not appear. It should be ordered as follows:
. A
. A
. B- Изменено Bruno.Costa 13 марта 2012 г. 13:28
-
13 марта 2012 г. 13:36
If you do not want those NULLS then simply restrict them using the where clause ! that is what the where clause works.
Try
CREATE TABLE YOURTABLE(NAME VARCHAR(10), PHONE VARCHAR(20))
INSERT INTO YOURTABLE VALUES('A',12121) INSERT INTO YOURTABLE VALUES('B',12122) INSERT INTO YOURTABLE VALUES(NULL,12124)
SELECT Name,Phone FROM YOURTABLE WHERE NAME IS NOT NULL ORDER BY NAME
Thanks
Manish
Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful.- Предложено в качестве ответа Lalith Sarika 13 марта 2012 г. 22:19
-
13 марта 2012 г. 13:39the problem that if you run the select from view within SSMS, the fields do not appear nulls.
they appear only in view of the report. -
20 марта 2012 г. 2:23Модератор
Hi Bruno,
In your case, I think that we can add a filter to eliminate null values on the report level and then sort the report column. For example, we can add a filter like this:
Expression: =IsNothing(Fields!Name.Value)OR (Fields!Name.Value="")
Operator: =
Value: =False
For more information, please see:
Add a Filter: http://technet.microsoft.com/en-us/library/ms156270(v=sql.100).aspx
Sort Data in a Data Region: http://technet.microsoft.com/en-us/library/ms157462(v=sql.100).aspx
Regards,
Bin LongBin Long
TechNet Community Support
- Помечено в качестве ответа Elvis LongMicrosoft Contingent Staff, Moderator 23 марта 2012 г. 1:26

