79277279

Date: 2024-12-13 05:18:34
Score: 1
Natty:
Report link

A method to get around making global temp tables, is to create the local temp table, then alter the structure in sp_executesql code. For example:

CREATE TABLE #tempExample (temp Bit NULL)
EXEC sp_executesql N'ALTER TABLE #tempExample ADD neededCol1 Int, neededCol2 Int'
ALTER TABLE #tempExample DROP COLUMN temp
Reasons:
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: jerclay