conversion from nvarchar to int in sql-2005

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 2911
    New Member
    • Dec 2007
    • 4

    conversion from nvarchar to int in sql-2005

    hi to all,

    i had declared a variable as nvarchar in sql-2005.
    lr( nvarchar) -- hyd pd 0000001 hyd ---it will be saved.
    but it will be auto generated value in asp.net front end.
    like hyd pd 0000002 hyd ,hyd pd 0000003 hyd , ....
    for auto increment i can using max( lr )+1.

    i got the error like:: Conversion failed when converting the nvarchar value 'hyd pd 00000001 hyd' to data type int

    please give me solution
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    You are not able to convert letters to an integer, split the string before converting the numbers to integer and then add. HTH.

    Comment

    Working...