• Ok, why, why, why, why are you wanting to do this? I hope this isn't for a production system, because it's far from good design.

    You need to use dynamic SQL. You'll have to build up the sql statement, based off the system tables, and then execute that statement.

    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