August 15, 2012 at 8:44 pm
Comments posted to this topic are about the item Table Variable
August 15, 2012 at 10:00 pm
Good one. Learnt something obvious 🙂
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
August 15, 2012 at 11:31 pm
Nice question, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
August 15, 2012 at 11:49 pm
It is also worth noting that you have no method of resetting the identity counter for the table.
Thanks for the question. I were fairly sure that I had it right before submitting, but the other choices listed had me re-check. And I were right 🙂
August 15, 2012 at 11:54 pm
Keld Laursen (VFL) (8/15/2012)
It is also worth noting that you have no method of resetting the identity counter for the table.Thanks for the question. I were fairly sure that I had it right before submitting, but the other choices listed had me re-check. And I were right 🙂
Very rightly pointed out Keld. Truncate resets the identity counter for the table..
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
August 15, 2012 at 11:56 pm
Lokesh Vij (8/15/2012)
Keld Laursen (VFL) (8/15/2012)
It is also worth noting that you have no method of resetting the identity counter for the table.Thanks for the question. I were fairly sure that I had it right before submitting, but the other choices listed had me re-check. And I were right 🙂
Very rightly pointed out Keld. Truncate resets the identity counter for the table..
Which were my point exactly: No truncate, no reset. Other DML to reset the counter will also fail.
August 16, 2012 at 12:09 am
Keld Laursen (VFL) (8/15/2012)
Lokesh Vij (8/15/2012)
Keld Laursen (VFL) (8/15/2012)
It is also worth noting that you have no method of resetting the identity counter for the table.Thanks for the question. I were fairly sure that I had it right before submitting, but the other choices listed had me re-check. And I were right 🙂
Very rightly pointed out Keld. Truncate resets the identity counter for the table..
Which were my point exactly: No truncate, no reset. Other DML to reset the counter will also fail.
I was just trying to re-iterate, as Table variable does not allow truncate to be used, identity counters will not reset 🙂
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
August 16, 2012 at 2:14 am
This was removed by the editor as SPAM
August 16, 2012 at 4:35 am
August 16, 2012 at 5:47 am
Great learning question for me.
August 16, 2012 at 6:49 am
A good question. This is a drawback to using table variables for temporary storage that you need to remember to work around.
August 16, 2012 at 6:53 am
sestell1 (8/16/2012)
A good question. This is a drawback to using table variables for temporary storage that you need to remember to work around.
Actually, this is not a drawback and you don't have to work around it. In the link that was included in the answer of this question (which leadsd to a change request posted by a user, and closed by Microsoft), a Microsoft engineer posts the following information:
"There is no difference between DELETE without WHERE clause and TRUNCATE TABLE on temporary tables or table variables. This is due to the behavior of logging in tempdb."
August 16, 2012 at 7:00 am
Had to double-check the use of IDENTITY in table variables.
Good question -- and good answer choices!
August 16, 2012 at 7:18 am
Thomas Abraham (8/16/2012)
Nice question. Thanks for the contribution. Never thought of truncating a temp table. But, it reminded me about limitations of this feature.
+ 1
Viewing 15 posts - 1 through 15 (of 27 total)
You must be logged in to reply to this topic. Login to reply