• Just to make sure you understand... the temporary tables still physically reside in tempdb. They still show up in tempdb.sys.tables and tempdb.sys.columns (indexes, constraints, etc.) They are just of the collation of the contained database instead of tempdb.

    For instance, if you run this in a contained database:

    USE ContainedDB;

    GO

    CREATE TABLE #TestTable (

    RowID INT IDENTITY PRIMARY KEY CLUSTERED,

    SSN char(9) NOT NULL UNIQUE,

    Age tinyint CHECK(Age>18));

    CREATE INDEX IX_TestTable ON #TestTable (Age, SSN);

    declare @object_id int;

    set @object_id = object_id('tempdb..#TestTable');

    select * from tempdb.sys.tables where object_id = @object_id;

    select * from tempdb.sys.key_constraints where parent_object_id = @object_id;

    select * from tempdb.sys.check_constraints where parent_object_id = @object_id;

    select * from tempdb.sys.indexes where object_id = @object_id;

    select * from tempdb.sys.objects where type = 'U';

    You will get returned to you all of the meta-data from tempdb for this temporary table.

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2