Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] CTE doesnt work with update or insert, only select #596

Open
magiva opened this issue Dec 3, 2024 · 0 comments
Open

[BUG] CTE doesnt work with update or insert, only select #596

magiva opened this issue Dec 3, 2024 · 0 comments

Comments

@magiva
Copy link

magiva commented Dec 3, 2024

Describe the bug
With mySource AS (
Select top 1 statuscode
from account
)

UPDATE a
SET a.accountabc = 1
FROM account a
Where a.accountid = 233

I cant use the CTE as source for an Insert or Update.
Its happy with Select

Msg 40517, Level 16, State 1, Line 1
Keyword or statement option 'WITH' is not supported in this version of SQL Server.

To Reproduce
Query to reproduce the behavior:

With mySource AS (
Select top 1 statuscode
from account
)

UPDATE a
SET a.accountabc = 1
FROM account a
Where a.accountid = 233

Expected behavior
use the source cte for update or insert

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • SQL 4 CDS edition: XrmToolBox
  • Results of SELECT @@VERSION:
  • Microsoft Dataverse - 9.2.24104.202
    
    SQL 4 CDS - 9.4.1.0
    Nov 28 2024 09:20:15
    Copyright © 2020 - 2024 Mark Carrington

Additional context
i do see it says not with this version, i should have put this as a feature request, sorry

@magiva magiva changed the title [BUG] [BUG] CTE doesnt work with update or insert, only select Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant