I have this query that needs to convert a string field that is suppose to contain an SSN to an int, but it is failing because there is data in there where the last character is alpha. Example: 123456789N (Bad db design in my opinion, but I have to live with it).
Is there a way I convert this to an integer and just return 123456789. I don't want to assume that the last character is always the problem. For example, should there be a SSN that says 12345X6789 then I would like to return 12345, like using the Val function in VB.
Any ideas how I can do this in SQL? I'm using SQL Server 2000.
Thanks.
Is there a way I convert this to an integer and just return 123456789. I don't want to assume that the last character is always the problem. For example, should there be a SSN that says 12345X6789 then I would like to return 12345, like using the Val function in VB.
Any ideas how I can do this in SQL? I'm using SQL Server 2000.
Thanks.