|
Posted by Ed Murphy on 09/08/06 02:03
cphite@gmail.com wrote:
> Or, we could realize that he's probably working on something right now
> and needs an answer to his rather simple question. We could point out
> to him that there are more standard ways of doing what he's doing, and
> if he cares we could point him towards those ways.
The time to tell the newbie "don't do that" is /now/ - not two years
later, after the bad method has spent two years getting itself
entrenched in the system.
Original Poster, if you're still reading this thread: it would almost
certainly be better to use a table with a static name, moving the
dynamic portion to a column within that table, e.g.
-- ##TICKETS has structure (TICKET VARCHAR(20), DATA XML)
INSERT INTO ##TICKETS (TICKET, DATA) VALUES (@TICKET, @DATA)
I'm not familiar with global temp tables (I've learned a little by
Googling today) so I'll let someone else address their pros/cons.
Speaking of Googling, this seems particularly relevant:
http://www.sommarskog.se/dynamic_sql.html#Cre_tbl
Navigation:
[Reply to this message]
|