-- Drop temp. table if it exists IF object_id('tempdb..#SelectedCustomers') IS NOT NULL DROP TABLE #SelectedCustomers>I am creating a temp table inside a store proc. Depending on whether an input
>-- @tcState is an input parameter to the stored proc, and is in scope. >IF @tcState IS NOT NULL BEGIN > SELECT kCustomer > INTO #SelectedCustomers > FROM Customers > WHERE cState = @tcState >END >ELSE BEGIN > SELECT kCustomer > INTO #SelectedCustomers > FROM Customers >END