Conversion failed when converting from a character string to uniqueidentifier.

  • Thread starter Thread starter Allen Moss
  • Start date Start date
A

Allen Moss

I keep getting a conversion failed when converting from a character string
to uniqueidentifier when running the sql below in SQL server 2005. You can
run it in the the management sql server studio. BranchID is a
uniqueidentifier. If you substitute
'850221aa-6cea-4831-b3f3-c81f36d77d71','850221aa-6cea-4831-b3f3-c81f36d77d72'
where @pClientID is used in BranchID in (@pClientID) ) the sql workd fine.

PLEASE HELP!!!

set QUOTED_IDENTIFIER off
declare @pClientID varchar(1000)
set @pClientID =
"'850221aa-6cea-4831-b3f3-c81f36d77d71','850221aa-6cea-4831-b3f3-c81f36d77d72'"
select @pClientID

SELECT * FROM PostalCodeMaster
where PostalCodeMasterid in ( select postalcodemasterid from postalcodelist
where BranchID in (@pClientID) )
ORDER BY PostalCode, City, County
 
Back
Top