Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Incorrect Syntax near A32

(0) ShareShare
ReportReport
Posted on by 3,610

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

  • Suggested answer
    Daniel Wikell Profile Picture
    Daniel Wikell 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans