Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

In select query values with space appended takes higher precedence than normal characters Expand / Collapse
Author
Message
Posted Wednesday, August 19, 2009 3:09 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, August 19, 2009 3:01 AM
Points: 3, Visits: 2
In select query values with space appended takes higher precedence than normal characters . How to overcome this . I.e the result is like this as shown below but i want 1001 to come on the top. Since i am using union all cannot use order by.
Cost Evaluation Sheet
Decision Gate 1 Complete
Involvement Complete
Statement of Work
1001
Post #773300
Posted Wednesday, August 19, 2009 3:37 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, April 15, 2014 4:32 AM
Points: 2,678, Visits: 2,394
Why can't you use ORDER BY?

try this

declare @items1 table (item varchar(100))
declare @items2 table (item varchar(100))

insert into @items1
select 'Cost Evaluation Sheet'
union select 'Decision Gate 1 Complete'
union select 'Involvement Complete'
union select 'Statement of Work'

insert into @items2
select 1001


select item from @items1
union all
select item from @items2
order by item

returns

1001
Cost Evaluation Sheet
Decision Gate 1 Complete
Involvement Complete
Statement of Work

Post #773312
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse