I've been tracking through some code that has a type conversion error from varchar to uniqueidentifier
I started commenting out parts of the code and found the offending line of code
WHERE vaoq.Questionnaire_ID = '09C4C7B4-1275-460A-AE23-FFA9256B1ABE'
I checked that this is a valid GUID (using convert)
the only way I managed to get this fixed was to create a table variable and do this
DECLARE @r TABLE
INSERT INTO @r SELECT '09C4C7B4-1275-460A-AE23-FFA9256B1ABE'
and change my where clause to
WHERE vaoq.Questionnaire_ID IN (SELECT id FROM @r)
has anyone seen this before and can point me at anything online.. i'm 100% bamboozled as to why the "in" does not cause type confusion, but an equality statement does