August 25, 2017 at 12:06 am
Comments posted to this topic are about the item Dynamic SQL and TempTables
God is real, unless declared integer.
August 25, 2017 at 12:34 am
Good question thank you.
...
August 25, 2017 at 4:00 am
Nice question to end the week on, thanks Thomas
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
August 25, 2017 at 5:23 am
A nice and amusing question. I rather like the explanation because it's thorough without being verbose - I wouldn't have made as good a job of it (I would have prbably gone down some pointless side-tracks).
But rather a lot of lines of code code to digest, and it could have been raised exacly the same issues with only half the number of tables and insert statements, which would have been a more easily digestible version.
Tom
August 25, 2017 at 5:52 am
Thanks Thomas for an interesting question and a good explanation.
August 25, 2017 at 5:54 am
I get what he's trying to do, but procedures return an INT. This procedure never sets a return value, so it returns a 0.
August 25, 2017 at 6:08 am
dale_berta - Friday, August 25, 2017 5:54 AMI get what he's trying to do, but procedures return an INT. This procedure never sets a return value, so it returns a 0.
The procedure does indeed return an INT.
However, the procedure produces multiple result sets.
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
August 25, 2017 at 7:13 am
TomThomson - Friday, August 25, 2017 5:23 AMA nice and amusing question. I rather like the explanation because it's thorough without being verbose - I wouldn't have made as good a job of it (I would have prbably gone down some pointless side-tracks).But rather a lot of lines of code code to digest, and it could have been raised exacly the same issues with only half the number of tables and insert statements, which would have been a more easily digestible version.
I agree with both points here. I actually didn't do much to decipher all the code. I sort of skimmed the code and skipped to the answers. There was one and only one reasonable answer based on the temp tables being generated with dynamic sql so it was simple to answer.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 25, 2017 at 2:35 pm
Yet another question that turns us into code parsers. Less code would have been ideal on this one.
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
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply