Need Help with a script

  • Tried INSERT using fully qualified names, but can't use Column Name in this context was error I received.

    The name "XXX_Dev.YYY.ID" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.

    I am trying to move/copy a few columns from one DB, into another (new)table in a different DB. Both DBs are on same server.

    Probably siimple, but I need some help. 🙂

  • post the SQL script.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • sounds like you're trying to do something like this:

    insert into A (x,y,z)

    values (B.x,B.y,B.z)

    you should be doing this instead:

    insert into A (x,y,z)

    select B.x,B.y,B.z from B

    as requested earlier, please post your code for specific suggestions.

  • Thanks much. For both responses.

    The 'select' instead just 'values' part is what I needed.

    Will remember to post SQL I am trying to use in future as well.

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

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