I am creating a Dynamic CRM 2011 Report in SSRS. I use several joins, And use GUID in joins. For ex :


The problem comes from parameters. I have a parameter which its label is a name and the value is GUID of a record. I retrieve them from a Dataset. The query of the this Dataset(named siteDataset) is this :

select site.SiteId, site.Name from Site;

the siteId goes to the value of the parameter and site.name goes to the label of the parameter, the Parameter is named siteId itself.

But when I try to do this in another DataSet :


Give me the subject Error. I even tried this :

CONVERT(VARCHAR(50), site.SiteId)

in siteId DataSet; But no success.

Any help will appreciated.


This may be a typo in your question, but just to be safe I'll post this as a possible answer - you shouldn't have those single quotes around @siteId, it should be like this:


The text string '@siteId' can't be converted into a uniqueidentifier for that join, and will result in the error you mentioned:

SELECT CAST('@siteId' AS uniqueidentifier);

Msg 8169, Level 16, State 2, Line 1
Conversion failed when converting from a character string to uniqueidentifier.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.