J3D1-KN1G1-1t
asked on
SQL Query ISNULL with convert
Hi ALL,
Hows it going?
I have a simple question, I have this this query
ISNULL(itemID, 'Generic')
Which basically gives me an error message saying that I cant convert integer to 'Generic' and I know there is a convert or something similar I can use to convert integer into varchar.
Can you please tell me how to correctly write this code.
Cheers,
J3di
Hows it going?
I have a simple question, I have this this query
ISNULL(itemID, 'Generic')
Which basically gives me an error message saying that I cant convert integer to 'Generic' and I know there is a convert or something similar I can use to convert integer into varchar.
Can you please tell me how to correctly write this code.
Cheers,
J3di
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SELECT ISNULL(CAST(itemID AS VARCHAR(8)), 'Generic')
ASKER
thanks Dale and Jim for the answer and thorough explanation
CAST(ISNULL(itemID, 'Generic') as varchar(25))