Click here to Skip to main content
15,906,567 members
Home / Discussions / Database
   

Database

 
AnswerRe: select max(string) Pin
Xandip19-Nov-08 19:54
Xandip19-Nov-08 19:54 
GeneralRe: select max(string) Pin
Zeyad Jalil19-Nov-08 22:17
professionalZeyad Jalil19-Nov-08 22:17 
GeneralRe: select max(string) Pin
Ashfield19-Nov-08 22:27
Ashfield19-Nov-08 22:27 
AnswerRe: select max(string) Pin
Syed Mehroz Alam19-Nov-08 19:58
Syed Mehroz Alam19-Nov-08 19:58 
GeneralRe: select max(string) Pin
Zeyad Jalil19-Nov-08 22:17
professionalZeyad Jalil19-Nov-08 22:17 
AnswerRe: select max(string) Pin
Paddy Boyd20-Nov-08 0:00
Paddy Boyd20-Nov-08 0:00 
AnswerRe: select max(string) Pin
RGTuffin20-Nov-08 0:46
RGTuffin20-Nov-08 0:46 
AnswerRe: select max(string) Pin
Wendelius20-Nov-08 7:00
mentorWendelius20-Nov-08 7:00 
The answer Ashfield gave you is correct.

To give you some starting points for reformatting the values (Note, this is not the solution, just ideas you could use):
CREATE TABLE Test12 (
Column1 varchar(50)
)
--
insert into Test12 (Column1) values ('A1-50')
insert into Test12 (Column1) values ('A2-50')
insert into Test12 (Column1) values ('A10-50')
insert into Test12 (Column1) values ('A9-50')
--
SELECT Column1, 
       CHARINDEX('-', Column1),
       SUBSTRING(Column1, 0, CHARINDEX('-', Column1)),
       SUBSTRING(SUBSTRING(Column1, 0, CHARINDEX('-', Column1)), 2, 999),
       REPLICATE('0', 2 - LEN(SUBSTRING(SUBSTRING(Column1, 0, CHARINDEX('-', Column1)), 2, 999))) 
       + SUBSTRING(SUBSTRING(Column1, 0, CHARINDEX('-', Column1)), 2, 999)
FROM Test12


The need to optimize rises from a bad design.

My articles[^]

QuestionAdd Identity Key behaviour to existing primary key column. Pin
Xandip19-Nov-08 19:34
Xandip19-Nov-08 19:34 
AnswerRe: Add Identity Key behaviour to existing primary key column. Pin
Wendelius20-Nov-08 5:07
mentorWendelius20-Nov-08 5:07 
Question[Message Deleted] Pin
mobius11100119-Nov-08 5:05
mobius11100119-Nov-08 5:05 
AnswerRe: Database Class Design Pin
Wendelius19-Nov-08 8:02
mentorWendelius19-Nov-08 8:02 
QuestionReporting Services table KeepTogether property Pin
grewin18-Nov-08 23:33
grewin18-Nov-08 23:33 
AnswerRe: Reporting Services table KeepTogether property Pin
Ennis Ray Lynch, Jr.19-Nov-08 10:09
Ennis Ray Lynch, Jr.19-Nov-08 10:09 
GeneralRe: Reporting Services table KeepTogether property Pin
grewin19-Nov-08 16:56
grewin19-Nov-08 16:56 
AnswerRe: Reporting Services table KeepTogether property Pin
Syed Mehroz Alam19-Nov-08 18:58
Syed Mehroz Alam19-Nov-08 18:58 
GeneralRe: Reporting Services table KeepTogether property Pin
grewin19-Nov-08 19:37
grewin19-Nov-08 19:37 
GeneralRe: Reporting Services table KeepTogether property Pin
Syed Mehroz Alam19-Nov-08 19:50
Syed Mehroz Alam19-Nov-08 19:50 
GeneralRe: Reporting Services table KeepTogether property Pin
grewin19-Nov-08 20:08
grewin19-Nov-08 20:08 
QuestionHelp me with this Query Pin
Mhiny18-Nov-08 20:04
Mhiny18-Nov-08 20:04 
AnswerRe: Help me with this Query Pin
Wendelius19-Nov-08 8:48
mentorWendelius19-Nov-08 8:48 
GeneralRe: Help me with this Query Pin
Mhiny19-Nov-08 21:19
Mhiny19-Nov-08 21:19 
GeneralRe: Help me with this Query Pin
Wendelius20-Nov-08 6:11
mentorWendelius20-Nov-08 6:11 
QuestionSelf Referenced Tables. Pin
Xandip18-Nov-08 19:14
Xandip18-Nov-08 19:14 
Answer[Message Deleted] Pin
Parwej Ahamad18-Nov-08 22:04
professionalParwej Ahamad18-Nov-08 22:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.