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
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Please help me move these records to another table...

Please help me move these records to another table...

Scheduled Pinned Locked Moved Database
helpquestion
5 Posts 2 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.
  • S Offline
    S Offline
    Support123
    wrote on last edited by
    #1

    hi all, I am trying to copy the records from one table to another like this... INSERT INTO [Claims].[dbo].[DocumentData] ([DocumentId] ,[DocumentData] ,[DocumentName] ,[ContentType] ,[LastUser] ,[LastDate]) VALUES (SELECT DocumentQueueId, DocumentData, DocumentName, ContentType, AssignedTo, GetDate() FROM DocumentQueue WHERE (AssignedTo = 'nbad\SlabbertH')) yet i get an error: Msg 156, Level 15, State 1, Line 14 Incorrect syntax near the keyword 'SELECT'. Msg 102, Level 15, State 1, Line 14 Incorrect syntax near ')'. what is the correct syntax for copying the records from one table to another? After i copied the records to the other table i will truncate the previouse table....

    "Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

    S 1 Reply Last reply
    0
    • S Support123

      hi all, I am trying to copy the records from one table to another like this... INSERT INTO [Claims].[dbo].[DocumentData] ([DocumentId] ,[DocumentData] ,[DocumentName] ,[ContentType] ,[LastUser] ,[LastDate]) VALUES (SELECT DocumentQueueId, DocumentData, DocumentName, ContentType, AssignedTo, GetDate() FROM DocumentQueue WHERE (AssignedTo = 'nbad\SlabbertH')) yet i get an error: Msg 156, Level 15, State 1, Line 14 Incorrect syntax near the keyword 'SELECT'. Msg 102, Level 15, State 1, Line 14 Incorrect syntax near ')'. what is the correct syntax for copying the records from one table to another? After i copied the records to the other table i will truncate the previouse table....

      "Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

      S Offline
      S Offline
      soni uma
      wrote on last edited by
      #2

      Remove 'Values' for select statement and also one ')' at the end of select statement like insert into Table() (select from table1) :cool:

      S 2 Replies Last reply
      0
      • S soni uma

        Remove 'Values' for select statement and also one ')' at the end of select statement like insert into Table() (select from table1) :cool:

        S Offline
        S Offline
        Support123
        wrote on last edited by
        #3

        thank you... if this works... it would be a great start to a great weekend :-)

        "Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

        S 1 Reply Last reply
        0
        • S soni uma

          Remove 'Values' for select statement and also one ')' at the end of select statement like insert into Table() (select from table1) :cool:

          S Offline
          S Offline
          Support123
          wrote on last edited by
          #4

          Thank you, That did the trick... :-)

          "Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

          1 Reply Last reply
          0
          • S Support123

            thank you... if this works... it would be a great start to a great weekend :-)

            "Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

            S Offline
            S Offline
            soni uma
            wrote on last edited by
            #5

            It's my pleasure to help you. :cool:

            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