Hi,
I have a query written in Jet-SQL which i need to convert to T-SQL as I am upgrading an Access DB to SQL Server 2000.
Query is:
SELECT WDF_TBLSKILL.RECID,WDF_TBLSKILL.TECHNOLOGY,Iif(EXI STS(SELECT * FROM WDF_TBLCOMPANY_TBLSKILL_LNK WHERE SKILLID=WDF_TBLSKILL.RECID AND COMPANYID=857),1,0) AS CHOSENSKILL FROM WDF_TBLSKILL ORDER BY WDF_TBLSKILL.TECHNOLOGY ASC;
It is falling over on the 3rd select item (The Iif statement) which I want to return a 1 if any records are found in the subquery or 0 if they aren't.
I know Iif is not supported in SQL but can't find anything that seems to do the job.
Please help!!!SELECT WDF_TBLSKILL.RECID
, WDF_TBLSKILL.TECHNOLOGY
, case when EXISTS
(SELECT * FROM WDF_TBLCOMPANY_TBLSKILL_LNK
WHERE SKILLID=WDF_TBLSKILL.RECID
AND COMPANYID=857) then 1 else 0 end AS CHOSENSKILL
FROM WDF_TBLSKILL
ORDER BY WDF_TBLSKILL.TECHNOLOGY ASC|||thanks mate - much appreciated. you've saved me a lot of time and effort.
Showing posts with label upgrading. Show all posts
Showing posts with label upgrading. Show all posts
Sunday, March 11, 2012
Subscribe to:
Posts (Atom)