Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Cloud Computing
»
SQL Azure - Administration
»
Questions about temporary tables in SQL Azure...
Questions about temporary tables in SQL Azure
Rate Topic
Display Mode
Topic Options
Author
Message
WayneS
WayneS
Posted Wednesday, June 15, 2011 6:56 PM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 9:12 AM
Points: 6,370,
Visits: 8,235
I've been doing some research into how temporary tables work in SQL Azure, and I have a few questions that I can't find answers for.
My questions:
1. Can you build a local temp table with a user-defined data type?
2. Can you build a local temp table with a user-defined function?
3. Can you build a local temp table with named constraints?
4. Is the collation of local temp tables that of tempdb, or of the current database?
5. Are the object_id values for local temp tables positive or negative?
6. Is the local temp table built in tempdb, or the current database?
Note that most of these are things that change when using a contained database in Denali, and I suspect that some of these are also changed in Azure.
Thanks!
Edit: and if you happen to have a link that documents any of these, that would be most excellent!
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 #1126202
Grant Fritchey
Grant Fritchey
Posted Friday, June 17, 2011 9:21 AM
SSChampion
Group: General Forum Members
Last Login: Today @ 12:48 PM
Points: 13,381,
Visits: 25,169
WayneS (6/15/2011)
I've been doing some research into how temporary tables work in SQL Azure, and I have a few questions that I can't find answers for.
My questions:
1. Can you build a local temp table with a user-defined data type?
nope
2. Can you build a local temp table with a user-defined function?
Nope, nope
3. Can you build a local temp table with named constraints?
Yep, that works.
4. Is the collation of local temp tables that of tempdb, or of the current database?
Not sure, how the heck do you check?
5. Are the object_id values for local temp tables positive or negative?
Positive for the one I tested.
6. Is the local temp table built in tempdb, or the current database?
Based on the query I had to run to get the object_id, it's in tempdb.
Note that most of these are things that change when using a contained database in Denali, and I suspect that some of these are also changed in Azure.
Thanks!
Edit: and if you happen to have a link that documents any of these, that would be most excellent!
Hope that helps. I got most of them.
----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of:
SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans
Product Evangelist for
Red Gate Software
Post #1127455
WayneS
WayneS
Posted Friday, June 17, 2011 8:40 PM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 9:12 AM
Points: 6,370,
Visits: 8,235
Awesome Grant! Thank you very much!!!
Grant Fritchey (6/17/2011)
WayneS (6/15/2011)
I've been doing some research into how temporary tables work in SQL Azure, and I have a few questions that I can't find answers for.
My questions:
1. Can you build a local temp table with a user-defined data type?
nope
2. Can you build a local temp table with a user-defined function?
Nope, nope
3. Can you build a local temp table with named constraints?
Yep, that works.
4. Is the collation of local temp tables that of tempdb, or of the current database?
Not sure, how the heck do you check?
Hmm, good question. In Azure you can't access tempdb, so I've got no idea of how to test this out.
5. Are the object_id values for local temp tables positive or negative?
Positive for the one I tested.
6. Is the local temp table built in tempdb, or the current database?
Based on the query I had to run to get the object_id, it's in tempdb.
I assume your query was something like SELECT OBJECT_ID('tempdb..#table')?
Note that most of these are things that change when using a contained database in Denali, and I suspect that some of these are also changed in Azure.
Thanks!
Edit: and if you happen to have a link that documents any of these, that would be most excellent!
Hope that helps. I got most of them.
It helps a lot. You went above and beyond what I had asked you about earlier, so I thank you very much!
Okay, so in recap:
UDDT: Regular SQL: Yes; Denali: No in contained databases; Azure: No
UDF: Regular SQL: Yes; Denali: No in contained databases; Azure: No
Named constraints: Regular SQL: Yes; Denali: No in contained databases; Azure: Yes
Collation: Regular SQL: tempdb; Denali: Local DB in contained databases; Azure: ?
Local temp table object_id values: SQL <= 2008R2: Positive; Denali: Negative; Azure: Positive
Local temp table built in tempdb?: Yes
Global Temp Tables: Regular SQL: Allowed; Denali: Allowed; Azure: Denied
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 #1127715
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.