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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

insert_recordset not working

(0) ShareShare
ReportReport
Posted on by

Hi All,

When I'm trying to import the bulk data by insert_recordset using below query.

"insert_recordset tradeChartTable (value, PricePlan) 

select sum(value), PricePlan from tradeForecastView
group by PricePlan"

Then system throwing below error. 

"Cannot execute a data definition language command on KepTradeForecastDataView (KepTradeForecastDataView).The SQL database has issued an error.."

 

I have checked the eventVwr, there it's given below information. 

Incorrect syntax near the keyword 'AS'.. The SQL statement was: "SELECT SUM(T1.VALUE) AS f1,T1.PRICEPLAN AS f2, AS f3,N'kep' AS DATAAREAID,1 AS RECVERSION,IDENTITY(bigint,1,1) AS RECID INTO [##ax_tmp_kep3_87_104040]  FROM KEPTRADEFORECASTDATAVIEW T1 WHERE ((DATAAREAID=?) AND (((PRICEPLAN<>?) AND (PRICEPLAN<>?)) AND (EANID=?))) GROUP BY T1.PRICEPLAN ORDER BY T1.PRICEPLAN.

here I don't know why AS f3 came. 

Some other findings and information.

My View is a UnionQuery Based view.

My target table is Regular table.

If I change my target table as InMemory table, query is working fine. 

Please let me know what I'm missing here, or give me the information why its not working for Regular table.

 

--

Nunna

*This post is locked for comments

I have the same question (0)
  • Iulian Cordobin Profile Picture
    8,201 on at

    It has to do with the tables you have in your view. How many tables do you have in your view?

  • Iulian Cordobin Profile Picture
    8,201 on at

    And also wanted to ask, is any of the table(s) you are using in your View an Extended table?

  • Martin Dráb Profile Picture
    237,978 Most Valuable Professional on at

    Does the select work if you use it outside insert_recordset?

    Don't you get any errors when synchronizing database?

  • Community Member Profile Picture
    on at

    There are two tables in my view. [I mean in union query], and tables are not extended tables, both are just simple independent tables.

  • Community Member Profile Picture
    on at

    Hi Martin,

    I have no issues while synchronizing table.

    All select queries of that table are working very fine, even if I change the same insert_recordSet query to while select, its executing fine.

    As I said, the same insert_recordset query is working fine if my target table is In-Memory.

  • DianP Profile Picture
    25 on at

    Hi Nunna,

    I know this is old thread. But somehow I faced the same issue as yours.

    I used a view which is from a union query and I want to insert to temporary table with type TempDB for report purpose.

    Did you solve your issue?

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans