Passing a GUID value from command line using DTEXEC to a variable to be used as a parameter in OLEDB Source Query in SSIS Package fails with "Invalid character value for cast specification"

I found a case where customer was using a OLE DB Source & had specified a Parameterized SQL Command to pull the data. The parameter used in the WHERE clause was a string variable. Customer wanted to pass a GUID value to it to pull the data. Customer was passing the GUID value from command line "5E0DD61E-301D-4FE6-A6E5-53B3F1A4A154". When he ran the package it failed with error

"Invalid character value for cast specification"

 

Reason/ Resolution

Don't pass the GUID value as "5E0DD61E-301D-4FE6-A6E5-53B3F1A4A154"

BUT

Pass the GUID value as "{5E0DD61E-301D-4FE6-A6E5-53B3F1A4A154}"