From: Suzette on
Hi,

I'm attempting to compare information in a uniqueidentifier field using a
select statement and am having fits trying to get it to work.

Here's a sample of my SQL statement.

SELECT Organization.TreatAsTypeOf_ENUM, Organization.OrganizationID,
Organization.Organization, Organization.Email, Organization.URL,
Organization.Phone1, Organization.Phone2, Organization.ExternalAccountID,
Organization.CustomerTypeGUID_FK, Organization.BranchGUID_FK, Address.*,
CustomerType.* , Branch.BranchGUID, Branch.ParentBranchGUID

FROM (Organization LEFT JOIN Address ON Organization.BillToAddressGUID_FK =
Address.AddressGUID)
INNER JOIN CustomerType ON (Organization.BranchGUID_FK =
CustomerType.BranchGUID_FK) AND (Organization.CustomerTypeGUID_FK =
CustomerType.CustomerTypeGUID)

INNER JOIN Branch ON (Organization.BranchGUID_FK = Branch.BranchGUID)

WHERE Branch.ParentBranchGUID = '{65F02099-8E4C-4483-91B8-90AEF2838E76}' AND
CustomerTypeID = 'Home Owner ' ORDER BY Organization.OrganizationID

The part I'm having issue with is the WHERE statement. When I try to open
the recordset I get this error:
Syntax error converting from a character string to uniqueidentifier.

If I compare a uniqueidentifier to another one it works but if I try to save
the information and use it, I can't get it to work.

I'm doing this in VB and would LOVE some assistance. This is making me
crazy and I can't find any information on the web.

Thanks

Sue

From: Eric Isaacs on
You shouldn't need the braces, the { or }, when doing the comparison:

WHERE Branch.ParentBranchGUID =
'65F02099-8E4C-4483-91B8-90AEF2838E76' ...

-Eric Isaacs
From: Suzette on
Thanks, I tried several things but didn't remove the braces.

That worked.
Sue

"Eric Isaacs" <eisaacs(a)gmail.com> wrote in message
news:75c6a45c-7778-4fa8-aa28-4de1b7a716af(a)z72g2000hsb.googlegroups.com...
> You shouldn't need the braces, the { or }, when doing the comparison:
>
> WHERE Branch.ParentBranchGUID =
> '65F02099-8E4C-4483-91B8-90AEF2838E76' ...
>
> -Eric Isaacs

From: Mariano Gomez on
Where Branch.ParentBranchGUID = convert(uniqueidentifier,
'65F02099-8E4C-4483-91B8-90AEF2838E76')

Best regards,
--
MG.-
Mariano Gomez, MIS, MCP, PMP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com


"Suzette" wrote:

> Hi,
>
> I'm attempting to compare information in a uniqueidentifier field using a
> select statement and am having fits trying to get it to work.
>
> Here's a sample of my SQL statement.
>
> SELECT Organization.TreatAsTypeOf_ENUM, Organization.OrganizationID,
> Organization.Organization, Organization.Email, Organization.URL,
> Organization.Phone1, Organization.Phone2, Organization.ExternalAccountID,
> Organization.CustomerTypeGUID_FK, Organization.BranchGUID_FK, Address.*,
> CustomerType.* , Branch.BranchGUID, Branch.ParentBranchGUID
>
> FROM (Organization LEFT JOIN Address ON Organization.BillToAddressGUID_FK =
> Address.AddressGUID)
> INNER JOIN CustomerType ON (Organization.BranchGUID_FK =
> CustomerType.BranchGUID_FK) AND (Organization.CustomerTypeGUID_FK =
> CustomerType.CustomerTypeGUID)
>
> INNER JOIN Branch ON (Organization.BranchGUID_FK = Branch.BranchGUID)
>
> WHERE Branch.ParentBranchGUID = '{65F02099-8E4C-4483-91B8-90AEF2838E76}' AND
> CustomerTypeID = 'Home Owner ' ORDER BY Organization.OrganizationID
>
> The part I'm having issue with is the WHERE statement. When I try to open
> the recordset I get this error:
> Syntax error converting from a character string to uniqueidentifier.
>
> If I compare a uniqueidentifier to another one it works but if I try to save
> the information and use it, I can't get it to work.
>
> I'm doing this in VB and would LOVE some assistance. This is making me
> crazy and I can't find any information on the web.
>
> Thanks
>
> Sue
>
>
 | 
Pages: 1
Prev: SQL
Next: Sql server datatransfer??