web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Incorrect Syntax near A32

(0) ShareShare
ReportReport
Posted on by 3,634

In following query I am trying to grab list of parties but it throws an error that 'Incorrect Syntax near A32'. It seems fine but not sure where I am doing wrong.

DECLARE @SQL nvarchar(4000)

SET @SQL = 'DECLARE @BL nvarchar(500);
SELECT @BL = COALESCE(@BL + '', '', '''') + Buyer
FROM (
        SELECT new_lastname, CASE new_deceased
        WHEN 0 THEN COALESCE(new_name, '''') + '' '' + COALESCE(new_middlename, '''') + '' '' + COALESCE(new_lastname, '''')
        WHEN 1 THEN COALESCE(new_name, '''') + '' '' + COALESCE(new_middlename, '''') + '' '' + COALESCE(new_lastname, '''') + '' (D)''
        END AS Buyer
        FROM FilteredNew_party
        WHERE new_partytype = 1 and (FilteredNew_party.new_order = A37C6131-2A32-E611-80EA-0050568E5BEC) ) T
        ORDER BY new_lastname; SELECT @BL as BuyerList'
EXEC (@SQL)


Any Idea?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Daniel Wikell Profile Picture
    2,360 on at
    RE: Incorrect Syntax near A32

    A32 appears in the guid you have in your WHERE-clause so it is probably trying to interprete it as a command. Try surrounding the guid with quotes.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans