Microsoft SQL: Incorrect syntax error

Hi all I am getting this error: Microsoft SQL: Incorrect syntax near the keyword ‘drop’.
Incorrect syntax near ‘)’.
image
image
m_code.txt (85.2 KB)

the parameter is &Dealname& sorry cannot share the .pbix file.

Formatted for the reader. @cifesi did you intend to add this to the post?

=-=-=-=-=-=-=-=-

= Sql.Database(
rocktopanalytics.public.eed85c94293a.database.windows.net,
3342”,

“products”,
[Query = "#(lf)#(lf)#(lf)#(lf)drop table if EXISTS #pop#(lf)drop table if EXISTS #data#(lf)drop table if EXISTS #roll#(lf)drop table if EXISTS #grades#(lf)drop table if EXISTS #title#(lf)drop table if EXISTS #legal#(lf)drop table if EXISTS #docs#(lf)drop table if EXISTS #property#(lf)drop table if EXISTS #sd#(lf)drop table if EXISTS #voms#(lf)drop table if EXISTS #temp#(lf)drop table if EXISTS #cred#(lf)#(lf)#(lf)SELECT LoanID=l.Id,
t_p.Name ,
l.ServicerLoanNumber,
l.LoanNumber,
l.LoanFundingDate,
l.currentassetstatus,
tl_p.Status,
l.CurrentAssetType,
l.UPBAmount,
Value=pv.Value,
loc.State,
#(lf)TitleProductId=(SELECT top 1 tp.Id
FROM products.OrderLines ol

Let me repost that, did not mean to pu that up there

Please can you help me delete this post.

Then I would repost it.