TSQL Define Temp Table (or table variable) Without Defining Schema?
问题 Is there a way to define a temp table without defining it's schema up front? 回答1: Actually using a table VARIABLE, an in-memory table, is the optimal way to go. The #table creates a table in temp db, and ##table is global - both with disk hits. Consider the slow-down/hit experienced with the number of transactions. CREATE PROCEDURE [dbo].[GetAccounts] @AccountID BIGINT, @Result INT OUT, @ErrorMessage VARCHAR(255) OUT AS BEGIN SET NOCOUNT ON; SET @Result = 0 SET @ErrorMessage = '' DECLARE @tmp