February 8, 2014 at 1:01 pm
Comments posted to this topic are about the item Temporary table in a batch
February 8, 2014 at 7:07 pm
February 9, 2014 at 9:49 am
Interesting "feature" of SQL Server 🙂
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
February 9, 2014 at 11:22 am
Nice question.
Not sure why someone would try to create the same temp table twice in the same procedure. If needing to use the same temp table then clear it and reinsert. Or just use a new temp table with a new name.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
February 9, 2014 at 1:56 pm
Nice question. It's by design.
Thanks.
Regards,
Igor
Igor Micev,My blog: www.igormicev.com
February 9, 2014 at 5:29 pm
Nice one thanks.
Hope this helps...
Ford Fairlane
Rock and Roll Detective
February 9, 2014 at 8:21 pm
Nice question.
But the explanation appears to have swallowed the good old party line: sometimes (and it seems reasonably certain that this is one of those times) "it's by design" means "someone made a mess of this, but there's not much point in fixing it so we'll pretend that's what was intended". I've watched that happen in standard writing as well as in code writing and in requirements writing; sometimes the result is pretty harmless, as here, but at other times it is far from harmelss - but the culprits still spout the "it's by design" mantra.
As for
explanation
Books online states it vaguely as“If more than one temporary table is created inside a single stored procedure or batch, they must have different names.”
Detailed explnation is available at - http://www.tectalks.com/493/temporary-table-could-not-be-re-created/
there is nothing at all vague about the BOL statement, and the "Detailed explanation" doesn't say anything that BOL doesn't.
Tom
February 10, 2014 at 1:34 am
Also the Begin is missing after AS at the start 🙂
February 10, 2014 at 1:45 am
This was removed by the editor as SPAM
February 10, 2014 at 2:29 am
L' Eomot Inversé (2/9/2014)
Nice question.But the explanation appears to have swallowed the good old party line: sometimes (and it seems reasonably certain that this is one of those times) "it's by design" means "someone made a mess of this, but there's not much point in fixing it so we'll pretend that's what was intended". I've watched that happen in standard writing as well as in code writing and in requirements writing; sometimes the result is pretty harmless, as here, but at other times it is far from harmelss - but the culprits still spout the "it's by design" mantra.
As for
explanation
Books online states it vaguely as“If more than one temporary table is created inside a single stored procedure or batch, they must have different names.”
Detailed explnation is available at - http://www.tectalks.com/493/temporary-table-could-not-be-re-created/
there is nothing at all vague about the BOL statement, and the "Detailed explanation" doesn't say anything that BOL doesn't.
+ 1, Agree.
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
February 10, 2014 at 2:30 am
bitbucket-25253 (2/8/2014)
Interesting question
+ 1, yes.
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
February 10, 2014 at 5:14 am
Good One.
---------------------------------------------------
"Thare are only 10 types of people in the world:
Those who understand binary, and those who don't."
February 10, 2014 at 6:18 am
Good question. I think this is all about SQL being a declarative language.
February 10, 2014 at 6:34 am
nice question ... thanks for sharing
February 10, 2014 at 8:15 am
SQLRNNR (2/9/2014)
Nice question.Not sure why someone would try to create the same temp table twice in the same procedure. If needing to use the same temp table then clear it and reinsert. Or just use a new temp table with a new name.
It`s just not practical to create the same temp table twice in the same SP, there is no logic to do that, but the question was interesting enough that I had to test it my self as never did that before.
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
Viewing 15 posts - 1 through 15 (of 25 total)
You must be logged in to reply to this topic. Login to reply