Q: Error converting the varchar value to data type int I have a query that pulls accruals. We recently added a new "floating holiday" and I am unable to pull it. It was easy before, the code for the different accruals were coded as single numbers. They set the new one up as a letter and I cant pull anything now. Below is my code before the letter accrual. I am a total SQL newbie I will add, the below code took me about  a month to produce.
select 
    prec_emp as 'Employee ID',
    case 
        when prec_type = 2 then 'Sick'
        when prec_type = 1 then 'Annual'
        when prec_type = 3  then 'Personal Holiday'
        when prec_type = 6  then 'Comp Time'
        when prec_type = 4  then 'Holiday Banked'
        /*when prec_type = 9  then 'Covid Vaccine Personal Holiday'*/
        else null 
    end as 'Time Off',
    convert(varchar(10), getdate(), 101) as 'Date',
    prec_avail as 'Hours',
    'Y' as 'Import Balances Reflect Taken',
    'N' as 'Import Balances Reflect Scheduled',
    'N' as 'Import Balances Are Added To Authorized'
from 
    prempacc
where 
    prec_active = 'Y' 
    and prec_type in (1, 2, 3, 6, 4)


A: As I understand it from your question, prec_type is the VARCHAR column. If that's the case then changing your code to the following should allow it to run and add in your new floating holiday.
select prec_emp as 'Employee ID',
case when prec_type = '2' then 'Sick'
when prec_type = '1' then 'Annual'
when prec_type = '3'  then 'Personal Holiday'
when prec_type = '6'  then 'Comp Time'
when prec_type = '4'  then 'Holiday Banked'
when prec_type = 'F' then 'Floating Holiday'
/*when prec_type = '9'  then 'Covid Vaccine Personal Holiday'*/
else null end as 'Time Off',
convert(varchar(10),getdate(),101) as 'Date',
prec_avail as 'Hours',
'Y' as 'Import Balances Reflect Taken',
'N' as 'Import Balances Reflect Scheduled',
'N' as 'Import Balances Are Added To Authorized'
From prempacc
Where prec_active = 'Y' and prec_type in ('1','2','3','6','4','F')

