• Tom.Thomson (2/9/2010)


    Rupal Raval (1/5/2010)


    what error does it throw?

    have you written

    'declare @tablevariable varchar(100)

    set @tablevariable = 'any valid table name'

    Before code C?

    map @tablevariable to one of your database table, select that database as current database and then execute the code

    No, and it wouldn't help if I did. I don't have a table called 'any valid table name' in any database on my server. (I know that sounds nasty - but the provocation was extreme!)

    Claiming that this is a sensible question with a sensible answer because it's obvious that unless you change the question all the answers are wrong is just nonsense. Yes, there are real life situations like that (the requirement as provided is nonsense), but in those situations you should not guess what part of the question (requirement) you have to change, you should throw the thing back at whoever provided the question and point out that it's nonsense. Otherwise you risk finding yourself spending a lot of effort on doing something completely useless, because you guessed wrong. And in practise, no matter how obvious it looks to you what the required modification is, you are NOT the person who understands the business inside out and specifies the requirement, so your guess will often be wrong. (If you were the person with that knowledge and understanding, you would be writing the requirement, and would not make silly errors like that - I hope.)

    Explain to me why you think each of the answers is wrong.