K
Keith G Hicks
vb.net 2008
I have a MS SQL stored procedure that uses # temp tables in the following
manner:
create #counties (countyname varchar(20))
insert into #counties ......
select firstname, lastname, address
from personlist pl inner join #counties c on pl.county = c.countyname
A string of countys is passed into the procedure and turned into a temp
table for filterin the personlist. I've been using this strategy for years
and it's always worked fine. I use these procs as the source for MS Access
reports, Delphi reports, etc. Never a problem.
Now I'm trying to create a data source in a VS.net vb project. I select the
connection I need, find the list of stored procedures and check off the one
that I need. It happens to use # temp tables as in the example above. When I
try to "finish" the data source I get this error:
<DLNP.dbo.sp_RptAdjLetter_4_RunLetter> Invalid object name '#counties'.
This procedure currently runs an MS Access report without a hitch. I can run
it just fine from a query window in SSMS. In addtion, there is no dynamic
sql in the procedure. The # temp tables are all "created" as in the example
above. I also tried using ## temp tables just for kicks but got the same
results.
How is this handled as using # temp tables in MS SQL stored procedures is
very common.
Thanks,
Keith
I have a MS SQL stored procedure that uses # temp tables in the following
manner:
create #counties (countyname varchar(20))
insert into #counties ......
select firstname, lastname, address
from personlist pl inner join #counties c on pl.county = c.countyname
A string of countys is passed into the procedure and turned into a temp
table for filterin the personlist. I've been using this strategy for years
and it's always worked fine. I use these procs as the source for MS Access
reports, Delphi reports, etc. Never a problem.
Now I'm trying to create a data source in a VS.net vb project. I select the
connection I need, find the list of stored procedures and check off the one
that I need. It happens to use # temp tables as in the example above. When I
try to "finish" the data source I get this error:
<DLNP.dbo.sp_RptAdjLetter_4_RunLetter> Invalid object name '#counties'.
This procedure currently runs an MS Access report without a hitch. I can run
it just fine from a query window in SSMS. In addtion, there is no dynamic
sql in the procedure. The # temp tables are all "created" as in the example
above. I also tried using ## temp tables just for kicks but got the same
results.
How is this handled as using # temp tables in MS SQL stored procedures is
very common.
Thanks,
Keith