Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select Statement - SQL Server 2005

Author  Topic 

paramu
Posting Yak Master

151 Posts

Posted - 2009-03-16 : 04:31:41

I looking for the following to utilize the VAL or INT functions
with select query in SQL-Serever 2005

select * from emp_master order by val(emp_id) asc

Ideas will be appreciated

Thanks & Regards
PARAMU

Paramu @ PARANTHAMAN

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-03-16 : 04:50:35
select * from emp_master order by cast(emp_id as INT) asc

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

paramu
Posting Yak Master

151 Posts

Posted - 2009-03-16 : 05:08:15
But field emp_id is also having the values like M-25,M-26,1792
....

so giving error.



Paramu @ PARANTHAMAN
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-03-16 : 07:20:14
[code]SELECT *
FROM emp_master
ORDER BY LEN(emp_id),
emp_id[/code]


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

paramu
Posting Yak Master

151 Posts

Posted - 2009-03-16 : 08:32:05
select * from emp_master order by len(emp_id),emp_id

Fine. & Thanks

"Service To The Mankind Is The Way Of Piece"

Paramu @ PARANTHAMAN
Go to Top of Page
   

- Advertisement -