barnesco
asked on
Formatting CASE statement from VARCHAR to BIGINT
My case statement below formats well, however, I'd like to convert the varchar output into a bigint, but I'm not sure where I'm going wrong. I receive the error message: Error converting data type varchar to bigint.
SET @StorePhone = '(123)456-7891'
StorePhone = CASE SUBSTRING(@StorePhone, 1,1) WHEN '('
THEN 111111111
ELSE 222222222 END
Thanks
SET @StorePhone = '(123)456-7891'
StorePhone = CASE SUBSTRING(@StorePhone, 1,1) WHEN '('
THEN 111111111
ELSE 222222222 END
Thanks
what in case the phone number is of the format 999-99999-999
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It's a varchar (to accept all those parenthesis and dashes), but the table is a bigint, which is why I'm converting it.
ASKER
I found it's another part of the query that's not working (not shown). Thanks for confirming the above worked.