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 |
er.bhupinder53
Starting Member
13 Posts |
Posted - 2011-07-07 : 21:11:51
|
I have a column where I have to split a value starting with Pand want to find the maximum number out of the result.Example I have data like:Paa00001,Pab00002,paa00005,pqa00012I want result as "00012" the maximum integral value. and then add one to it with a constant prefix PXXSo in this case final expected result would be : "PXX00013"I have used the following code and getting nothing: SELECT MAX(SUBSTRING (id, 4,9) as interger ) as MaxvalueFROM my_tableWHERE id like 'P%'Please help |
|
|
|
|