Hi
We have tried to use Temporary table variable with a select statement in a stored procedure but not been able to make it work. Does anyone have a small example we can see, as the SQL help book is not providing any?
-- Insert some new records
INSERT into @sitetable
Select SiteId, SiteName From Sites
-- Now read the records from the table variable
Select COUNT(SiteID) as MyCount
From @sitetable Order by SiteId
--------------------------------
bperry
Well, that gave me this instead - a global temporay table:
set @sqlstring = N'SELECT Country, Ship, [LineNumber]INTO ##Temp FROM ' + @tbl
It doesn't seem to work with a local temp. tbl., so I must ensure that the table name change each time the procedure is called. However that is possible.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.