hdfgh f dfh fgh dfh fgh

  • i have problem in sql query, i just want to insert data from one table to another but problem is that data shud be insert according to condition..like

    i have two table: 1. TestReport(YourQues,WrongAns,Answer)....as new table

    2. Question(slNo,Question,Answer)

    i just want data of column Answer of table Question will inserted into TestReport according to feeded data of Question column of tableTestReport......for that i were using..query

    insert into TestReport (Answer) select Answer from Question where YourQues.TestReport= Question.Question;

    but its shoing error like "The multi-part identifire "YourQues.TestReport" could not be bound"...

    i think for that error i have to use inner join...but how ?????

    plzz give proper solution for that.....

  • try TestReport.YourQues

    instead of YourQues.TestReport

    (table name should come first)

  • pradeep_kodley175 (2/5/2010)


    insert into TestReport (Answer) select Answer from Question where YourQues.TestReport= Question.Question;

    but its shoing error like "The multi-part identifire "YourQues.TestReport" could not be bound"...

    There's no object called 'YourQues' anywhere in that insert statement. What's it supposed to refer to?

    Get a select statement working that shows the rows you want to insert, then add the INSERT INTO.

    select Answer from Question where YourQues.TestReport= Question.Question;

    The only table referred to there is Question. If you want another table, you need to join it in.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Please be professional and include a subject that applies when you post.

    You might want to read something like this: http://www.sqlservercentral.com/articles/T-SQL/67202/

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply