Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Contained database temporary tables


Contained database temporary tables

Author
Message
SQLRNNR
SQLRNNR
SSC-Insane
SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)

Group: General Forum Members
Points: 21137 Visits: 18259
Excellent question.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

Cliff Jones
Cliff Jones
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4069 Visits: 3648
mohammed moinudheen (4/14/2011)
This is a tough one really :-)

I agree, it is hard question and a very good one. Thanks.
WayneS
WayneS
SSCertifiable
SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)

Group: General Forum Members
Points: 6261 Visits: 10404
Cliff Jones (4/14/2011)
mohammed moinudheen (4/14/2011)
This is a tough one really :-)

I agree, it is hard question and a very good one. Thanks.


I think what makes this hard is that it works differently than before - which this question was designed to just bring those differences up for people to see.

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, How to ask a question, Performance Problems, Common date/time routines,
CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings

jts2013
jts2013
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1176 Visits: 5009
No idea what a contained database is, so I had to guess today! I'm sure someone will write an article soon? :-D
Peter Trast
Peter Trast
SSChasing Mays
SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)

Group: General Forum Members
Points: 642 Visits: 655
The bad part is that it appears to be an idea that was not completed. My first impression was that a contained database was completely independent of the instance like Oracle so that it is easier to move. This question seems to contradict that idea. Too bad, it is a great idea.

Peter Trast
Microsoft Certified ...(insert many literal strings here)
Microsoft Design Architect with Alexander Open Systems
WayneS
WayneS
SSCertifiable
SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)

Group: General Forum Members
Points: 6261 Visits: 10404
Peter, now I'm confused. How does this question contradict this database being independent of the instance that it's running on? That is exactly the idea behind a contained database.

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, How to ask a question, Performance Problems, Common date/time routines,
CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings

TomThomson
TomThomson
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10769 Visits: 12019
Peter Trast (4/14/2011)
I made the same wrong guesses as the majority. Got the first one right on collation but guessed that metadata would be in the contained database since my understanding was that these contained databases would not have instance dependencies. Sounds like that is not strictly true.

Gotta read more now!!! Smile Great question. I think we need more Denali questions. Any rumors on the actual name of this new version? Is it just SQL Server 2012 (sounds so forboding). I think "Maya" might have been a more interesting code name for 2012 :-D

I imagine that when you move a database to a new server, it doesn't at that point in time have any temporary tables. After all, the database needs to be quiescent when you move it, it can't have any active connections so there is no context (except perhaps a transaction context in the log, but then recovery will eliminate the temp table anyway) in which the temp table could exist. So having its metadata in the system collation instead of the database collation does not introduce any dependency on the instance in the sense that "dependency on the instance" is to be eliminated by contained tables, because when something creates the temp table on the new instance the metadata that used to exist on the old instance has no effect on anything at all.

Tom

WayneS
WayneS
SSCertifiable
SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)

Group: General Forum Members
Points: 6261 Visits: 10404
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, How to ask a question, Performance Problems, Common date/time routines,
CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search