Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 870581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:30:03+00:00 2026-05-15T10:30:03+00:00

i am getting the error as shown below : Msg 156, Level 15, State

  • 0

i am getting the error as shown below :

Msg 156, Level 15, State 1, Procedure Sp_Table1, Line 22
Incorrect syntax near the keyword 'AS'.

while executing this SQL:

WITH myCTE AS
(Select mci.* from
view_name AS si
JOIN merch_catalog_ipt_view_name AS mci
  ON mci.view_id = si.view_id
  AND mci.resolved_view_name_id = si.view_name_id
  AND mci.ctg_ipt_event_id = @ctg_ipt_event_id
  AND mci.accept_flag = 'y')

UPDATE view_name
SET name = (select mci.name from myCTE where myCTE.view_id = view_id)
,view_name_ctg_id = (select mci.resolved_view_name_ctg_id from myCTE where myCTE.view_id = view_id)
,xref_value = (select mci.xref_value from myCTE where myCTE.view_id = view_id)
,availability_start_date = (select mci.availability_start_date from myCTE where myCTE.view_id = view_id)
,availability_end_date = (select mci.availability_end_date from myCTE where myCTE.view_id = view_id)
,status_code = (select mci.status_code from myCTE where myCTE.view_id = view_id)
,last_modified_user_id = (select CASE WHEN mci.last_modified_user_id = 42 THEN @posting_user_id ELSE mci.last_modified_user_id END from myCTE where myCTE.view_id = view_id)
,last_modified_timestamp = CURRENT_TIMESTAMP
WHERE si.shi_flag = 'n'
and exists (select view_id from merch_catalog_ipt_view_name AS mci
  Where mci.view_id = view_name.view_id
  AND mci.resolved_view_name_id = view_name.view_name_id
  AND mci.ctg_ipt_event_id = @ctg_ipt_event_id
  AND mci.accept_flag = 'y')

Please help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T10:30:04+00:00Added an answer on May 15, 2026 at 10:30 am

    Try putting a semicolon ; just before your WITH, as

    When a CTE is used in a statement that is part of a batch, the statement before it must be followed by a semicolon.

    This has caught me out in the past.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a GWT app, and keep getting the error shown below. I
I am getting this bad version error as shown below. How to fix this.
I 'm getting error message shown below on deploying rails 3.0.10 app on Torquebox
I'm creating an application where I'm getting the error shown below. I'm using Tomcat
I have entity framework code as shown below.I am getting following error in where
I am getting a syntax error while using the DOCTYPE ... actually i have
When I try to execute my code, I'm getting an error dialog: 'Show Disassembly'
Getting an error when i use the following script to show a div when
I am getting an error when i try to show a diff set of
I am getting an error from a piece of code. I will only show

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.