Bondorofi
01-08-2007, 09:02 AM
SQL(2005) Server Management Studio
Can someone please help me. I have records denoted by 2 characters + 3 numbers (bb-100) and 5 characters + 3 numbers (hsaid-101)
Now I want to extract the numbers part only and use it in my database as a sequence...100, 101, 102 etc no characters.
I did the following...
CHARINDEX(Record_Number, '-') AS MEPI_ID, SUBSTRING(ddddd.Record_Number, 4, 3) AS MEPI_Seq,
This only works on records with 2 characters + 3 numbers (bb-100) yet I want a function that can handle both situations. Any suggestions?
Thanks
Can someone please help me. I have records denoted by 2 characters + 3 numbers (bb-100) and 5 characters + 3 numbers (hsaid-101)
Now I want to extract the numbers part only and use it in my database as a sequence...100, 101, 102 etc no characters.
I did the following...
CHARINDEX(Record_Number, '-') AS MEPI_ID, SUBSTRING(ddddd.Record_Number, 4, 3) AS MEPI_Seq,
This only works on records with 2 characters + 3 numbers (bb-100) yet I want a function that can handle both situations. Any suggestions?
Thanks