sql - Manipulations with temp tables on the same connection don't work with sprocs -
i have long-lived connection, on application creates temp table , uses fetch dynamic runtime data. understanding should possible reference temp table long done on same connection. possible indeed when bunch of raw queries, not possible sprocs. use ado.net.
am missing obvious here?
works
create table #customernames (customername nvarchar(200) primary key) declare @customername nvarchar(200) set @customername ='joe baker' insert #customernames (customername) values (@customernames)
doesn't work
exec customernames_createtemptable exec customernames_addcustomername 'joe baker'
where sprocs encapsulate queries
edit: solution create temp table outside of sproc using query , manipulations table on same connection using sprocs. way temp table doesn't go out of scope.
it's been while since worked sql server, far know, temporary tables created within stored procedure exist duration of procedure execution. in other words, dropped when procedure finished.
Comments
Post a Comment