Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Incorrect syntax near the keyword 'WITH'

Incorrect syntax near the keyword 'WITH'

Scheduled Pinned Locked Moved Database
helpdatabase
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    icanmakeiteasy
    wrote on last edited by
    #1

    Hi, DECLARE @Location_ID INT SELECT @Location_ID = 3 ;WITH ret AS( SELECT * FROM Locations WHERE Location_ID = @Location_ID UNION ALL SELECT t.* FROM Locations t INNER JOIN ret r ON t.Parent_ID = r.Location_ID ) SELECT * FROM ret here is my query, am getting error:Incorrect syntax near the keyword 'WITH' help me to fix this problem friends

    icanmakeiteasy

    M W 2 Replies Last reply
    0
    • I icanmakeiteasy

      Hi, DECLARE @Location_ID INT SELECT @Location_ID = 3 ;WITH ret AS( SELECT * FROM Locations WHERE Location_ID = @Location_ID UNION ALL SELECT t.* FROM Locations t INNER JOIN ret r ON t.Parent_ID = r.Location_ID ) SELECT * FROM ret here is my query, am getting error:Incorrect syntax near the keyword 'WITH' help me to fix this problem friends

      icanmakeiteasy

      M Offline
      M Offline
      Michel Godfroid
      wrote on last edited by
      #2

      Semi-colons do not display in Braille?

      D 1 Reply Last reply
      0
      • M Michel Godfroid

        Semi-colons do not display in Braille?

        D Offline
        D Offline
        David Skelly
        wrote on last edited by
        #3

        Michel Godfroid wrote:

        Semi-colons do not display in Braille?

        There's nothing wrong with the semi-colon. What point were you trying to make, or were you just trying to be smart?

        M 1 Reply Last reply
        0
        • D David Skelly

          Michel Godfroid wrote:

          Semi-colons do not display in Braille?

          There's nothing wrong with the semi-colon. What point were you trying to make, or were you just trying to be smart?

          M Offline
          M Offline
          Michel Godfroid
          wrote on last edited by
          #4

          :~ You're right, I stand corrected; sincere apologies. The line breaks and absence of indentation made me think the first couple of lines belonged to the same statement.

          1 Reply Last reply
          0
          • I icanmakeiteasy

            Hi, DECLARE @Location_ID INT SELECT @Location_ID = 3 ;WITH ret AS( SELECT * FROM Locations WHERE Location_ID = @Location_ID UNION ALL SELECT t.* FROM Locations t INNER JOIN ret r ON t.Parent_ID = r.Location_ID ) SELECT * FROM ret here is my query, am getting error:Incorrect syntax near the keyword 'WITH' help me to fix this problem friends

            icanmakeiteasy

            W Offline
            W Offline
            WoutL
            wrote on last edited by
            #5

            There is nothing wrong with this query unless you are using SQL 2000 or earlier!

            Wout Louwers

            I 1 Reply Last reply
            0
            • W WoutL

              There is nothing wrong with this query unless you are using SQL 2000 or earlier!

              Wout Louwers

              I Offline
              I Offline
              icanmakeiteasy
              wrote on last edited by
              #6

              srry, for the late reply am using sql server 2000, plz help me to achieve this in sql server 2000

              icanmakeiteasy

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups