June 12, 2007 at 12:00 pm
I am getting the following error
Msg 245, Level 16, State 1, Procedure TESTspCleanUp, Line 18
Syntax error converting the varchar value 'EXISTS in (select o.empid from emp o
inner join office op on op.empid=o.empid
inner join indicator ih on ih.empid=op.empid)' to a column of data type int.
When I run the proc
alter
Procedure [dbo].[TESTspCleanUp]
as
begin
select distinct
O
.empid,
Case O.empid When 'EXISTS in (select o.empid from emp o
inner join office op on op.offid=o.offid
inner join indicator ih on ih.empid=op.empid)'
then 'Y'else 'N'
END as status,
O
.Name,
O.Address2,
O
.City,
O
.State,
O
.ZipCode
from emp O
left
outer join LookupType T on O.empTypeId = T.empTypeId order by empid
June 12, 2007 at 1:15 pm
Your when statement is only a string
when 'string here'
It appears you are trying to
when exists(select yada from yadatable where yada1 = yada2)
then 'y' else 'n' end
The ticks are turning your TSQL into a string...
good luck
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply