Convert AlphaNumeric to Numeric

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gowrishankar
    New Member
    • Dec 2006
    • 1

    Convert AlphaNumeric to Numeric

    Hello,

    I have to convert a alpha numeric value to a numeric value using query.
    Is there a way to do it.

    The column data type is Varchar and I am storing alpha numeric values to it.
    I have to sort the column now. when I say order by [column name] it is not comming properly.

    Need some solution to do it.

    Regards,
    GowriShankar.
  • almaz
    Recognized Expert New Member
    • Dec 2006
    • 168

    #2
    Originally posted by gowrishankar
    Hello,

    I have to convert a alpha numeric value to a numeric value using query.
    Is there a way to do it.

    The column data type is Varchar and I am storing alpha numeric values to it.
    I have to sort the column now. when I say order by [column name] it is not comming properly.

    Need some solution to do it.

    Regards,
    GowriShankar.
    What do you mean by "alphanumer ic value"? Do you have non-numeric chars in the column? If yes, how do you expect it to be converted to numeric? If no, then use "convert(in t, ColumnName)" or "cast(ColumnNam e as int)" statements.
    Please post examples

    Comment

    • Vijayshankarp
      New Member
      • Jan 2007
      • 2

      #3
      Originally posted by almaz
      What do you mean by "alphanumer ic value"? Do you have non-numeric chars in the column? If yes, how do you expect it to be converted to numeric? If no, then use "convert(in t, ColumnName)" or "cast(ColumnNam e as int)" statements.
      Please post examples
      try like this
      SELECT Description
      FROM ModuleSetup
      ORDER BY CAST(Descriptio n AS varchar)

      Comment

      Working...