Link to home
Start Free TrialLog in
Avatar of Coloplast
ColoplastFlag for Denmark

asked on

SQL CAST or CONVERT

I'm trying to convert an INT to VARCHAR in my CASE statement by using the following:

SELECT CASE
		WHEN CAST(AuthenticationMode AS VARCHAR(7)) = '0' THEN 'Mixed'
		WHEN CAST([AuthenticationMode] AS VARCHAR(7)) = '1' THEN 'Windows'
	   ELSE [AuthenticationMode]
	   END AS 'AuthenticationMode'

Open in new window


But I get the following error:
Conversion failed when converting the varchar value 'Mixed' to data type int.

Any ideas?

Best regards

Rasmus
ASKER CERTIFIED SOLUTION
Avatar of Lokesh B R
Lokesh B R
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Coloplast

ASKER

Thanks for the fast solution :-)