Sorry for the dumb question, but given all the "things" that return tables... temp tables, table-valued functions, views, etc... Is there a guideline anywhere that explains when to use each one?
May 23, 2021 at 11:09 pm
Well, here's a start at least...
May 24, 2021 at 6:02 pm
My very general advice would be to stick to base tables and not use any of the features outside of the ANSI ISO standards for creating tables. Essentially, this advice reduces to "trust the optimizer, Luke." If you have a well-designed schema, everything is logical and under control, with lots of constraints. There's no reason you should mimic 1970s scratch tapes with tables. Were trying to be a declarative language that means you tell exactly what you want and you get the results. You do not have to do step-by-step intermediate things like temp tables or whatever get those answers.
Please post DDL and follow ANSI/ISO standards when asking for help.
May 25, 2021 at 1:04 am
My very general advice would be to stick to base tables and not use any of the features outside of the ANSI ISO standards for creating tables. Essentially, this advice reduces to "trust the optimizer, Luke." If you have a well-designed schema, everything is logical and under control, with lots of constraints. There's no reason you should mimic 1970s scratch tapes with tables. Were trying to be a declarative language that means you tell exactly what you want and you get the results. You do not have to do step-by-step intermediate things like temp tables or whatever get those answers.
Heh... that's coming from the guy that wrote a push-stack to do conversions of Adjacency Lists to Nested Sets. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
Learning T-SQL in a few easy steps...
Congratulations.
"Reading Is Fundamental" -- yeah, I guess it is.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply