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.
| Author |
Topic |
|
sadi
Starting Member
1 Post |
Posted - 2010-04-13 : 00:45:03
|
| Hi-I have a CYC_CD field which is VARCHAR. The values of this field indicate the cycle run code For Example 0109M(January 09 run), 1209M (December 09 run) so on so forth. When I convert it to an integer and use MAX function it gives me incorrect result becauase technically 0310M is the Max run and not 0409M .Is there a way where I can pick up the MAX value in the text field. In my case pick up 0310M record and not 0409M record ?Thanks SM |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2010-04-13 : 01:23:19
|
| Here your Query but its lack in performance when the table is largeselect max(cast(cast(year(getdate())as varchar(4))+left(CYC_CD,len(CYC_CD)-1) as datetime)) from table_nameSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
|
|
|