Home Forums SQL Server 2012 SQL 2012 - General How do i change a string key to an int - normal methods not working! RE: How do i change a string key to an int - normal methods not working!

  • isuckatsql (4/14/2014)


    Based on research and the lack of response, i guess it can't be done in SQL.

    Let's try C#.

    Again, answer the question asked below, what value do you expect this ( 'cht6p575l7ry61k1npt') to be converted to as an integer?

    TheSQLGuru (4/13/2014)


    Riddle me this: what integer do you expect from this value: 'cht6p575l7ry61k1npt'??

    any non-integer values need to be discarded. Unfortunately that is really not that easy BEFORE SQL 2012. But in the version you are posting against you have some new TSQL tools, namely TRY_CONVERT(). I leave it to you to hit Books Online or your resource of choice and work out the solution for yourself.