DataTable empty when Stored Proc uses temp table



Hi,

I have a SQL Server 2000 Stored proc which creates a temp table and
does a select on that to return the result set.
example:
[code]
create table #tmptable(afield varchar(255))
<insert values in to table>
select * from #tmptable
drop table #tmptable
[/code]

However when using this with a datatable, the datatable is always
empty. if i create a "real" table it works perfectly.

Any ideas why or how to get around this?

This is using C# on the dotnet 1.1 framework.

Thanks

.



Relevant Pages

  • Re: T-SQL how to deal with results from stored proc
    ... > My attempt was to use INSERT EXEC to fetch te results of several ... In a wrapping stored proc I intended to collect data ... You can also use temp tables, as I discuss in the article I pointed you to. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ...
    (comp.databases.ms-sqlserver)
  • Re: Stored procedure never finishes
    ... I have found that if I don't use temp tables then the stored proc works. ... > that you may have a run away query (this can't be fixed by restarting the ... > SQL Server MVP ...
    (microsoft.public.sqlserver.server)
  • Re: Using results form a stored procedure in an exists clause?
    ... > Consider saving the results in a temp table and then running the EXISTS ... > Don't name your stored proc with an sp_ prefix. ... > Columnist, SQL Server Professional ... >> Use a UDF instead of Stored procedure ...
    (microsoft.public.sqlserver.programming)
  • Using a stored proc to insert data...
    ... insert command to a SQL server table. ... How/where do I reference the stored proc? ... Prev by Date: ...
    (microsoft.public.biztalk.general)
  • temp table names
    ... Is there a way to get a "random" sql server generated temp table name that ... This way the same stored proc could be called from different threads and not ...
    (microsoft.public.sqlserver.programming)