• Hello Chris,

    quote:


    Is it possible, within T-sql, to name a variable or key and include the value of another variable within that name.

    I imagine the code may look something like this:

    set @myvar = 'new'

    alter table mytable

    add constraint fk_+@myvar

    foreign key (col2)

    references myothertable(col3)


    should be possible using dynamic sql.

    You may take a look at sp_executesql in BOL

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]