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. Insert Statment

Insert Statment

Scheduled Pinned Locked Moved Database
databasequestion
5 Posts 5 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
    Seema Bawa
    wrote on last edited by
    #1

    What is the wrong in this query insert into tbTasks_New( AssignedToId) values('Employee') where Owner = 'Seema'

    J C C D 4 Replies Last reply
    0
    • S Seema Bawa

      What is the wrong in this query insert into tbTasks_New( AssignedToId) values('Employee') where Owner = 'Seema'

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #2

      1. It isn't a query 2. An insert is an insert - 'where' doesn't apply (not for the form given.) It is also possible that 'Employee' is not a valid value for 'AssignedToId'

      1 Reply Last reply
      0
      • S Seema Bawa

        What is the wrong in this query insert into tbTasks_New( AssignedToId) values('Employee') where Owner = 'Seema'

        C Offline
        C Offline
        Chris Meech
        wrote on last edited by
        #3

        By Owner do you mean the schema owner of the table? I don't think I've ever seen an insert statement with a 'where' clause before. :confused:

        Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

        1 Reply Last reply
        0
        • S Seema Bawa

          What is the wrong in this query insert into tbTasks_New( AssignedToId) values('Employee') where Owner = 'Seema'

          C Offline
          C Offline
          Corporal Agarn
          wrote on last edited by
          #4

          As jschell said. If Owner is a column in a table an insert might be like:

          INSERT INTO tbTasks_New(AssignedToId)
          SELECT column1
          WHERE owner = 'Seema'

          If you use the value command you cannot use the where (you do not need to!)

          1 Reply Last reply
          0
          • S Seema Bawa

            What is the wrong in this query insert into tbTasks_New( AssignedToId) values('Employee') where Owner = 'Seema'

            D Offline
            D Offline
            Dnyanesh Wahiley
            wrote on last edited by
            #5

            your queary is like this... insert into tbTasks_New( AssignedToId) values('Employee') where Owner = 'Seema' and your solution will be like this...! Update tbTasks_New set='Employee' where Owner='Seema' ----------------------------------- Actually u have to use update statment insted of insert statment...! and then u will get ur expected output.!

            Dnyanesh Wahiley....

            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