Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Contained database temporary tables Expand / Collapse
Author
Message
Posted Thursday, April 14, 2011 9:56 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 7:56 AM
Points: 20,464, Visits: 14,094
Excellent question.



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


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1093643
Posted Thursday, April 14, 2011 12:00 PM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Thursday, April 17, 2014 12:10 PM
Points: 3,766, Visits: 3,584
mohammed moinudheen (4/14/2011)
This is a tough one really

I agree, it is hard question and a very good one. Thanks.
Post #1093714
Posted Thursday, April 14, 2011 12:29 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 12:59 AM
Points: 6,544, Visits: 8,761
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
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
Post #1093740
Posted Friday, April 15, 2011 4:31 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, April 08, 2014 6:23 AM
Points: 1,082, Visits: 4,887
No idea what a contained database is, so I had to guess today! I'm sure someone will write an article soon?
Post #1094017
Posted Friday, April 15, 2011 10:17 PM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Friday, March 15, 2013 10:35 AM
Points: 594, Visits: 654
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
Post #1094462
Posted Saturday, April 16, 2011 11:41 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 12:59 AM
Points: 6,544, Visits: 8,761
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
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
Post #1094516
Posted Tuesday, April 19, 2011 6:22 PM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Yesterday @ 8:37 AM
Points: 8,287, Visits: 8,738
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!!! :) 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

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
Post #1096035
Posted Tuesday, April 19, 2011 7:53 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 12:59 AM
Points: 6,544, Visits: 8,761
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
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
Post #1096049
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse