SQL Server Stored Procedure with temp table select, does not return correct result in LLBLGen Pro
When you create a stored procedure like:
if exists (select 1 from sysobjects where name = 'GetDataFromTempTable' and xtype = 'p') drop procedure [dbo].[GetDataFromTempTable] go create procedure [dbo].[GetDataFromTempTable] as begin -- Create temp table create table #MyTempTable ( [Id] int not null primary key, [Nummer] varchar(10) not null ) insert #MyTempTable ([Id], [Nummer]) values (1, 'Test1') -- Return all rows from the temp table select * from #MyTempTable end go
and generate code with LLBLGen Pro to call this stored procedure,
it will generate an Action Stored Procedure Call instead off a Retrieval Stored Procedure Call.
This is, because LLBLGen Pro by default automatically generates the return type. see
By changing the user preference AutoDetermineSProcType to false, you can manually change the amount of result sets during the catalog refresh.
LLBLGen Pro > File > Preferences… > AutoDetermineSProcType > set to false
LLBLGen Pro > Project > Refresh All Catalogs… > Manually select the stored procedures to retrieve
> New number of Resultsets for selected procedures > set to 1
The stored procedure can now be added to Retrieval Stored Procedure Calls instead of Action Stored Procedure Calls.Tags: LLBLGen
3 Replies to “SQL Server Stored Procedure with temp table select, does not return correct result in LLBLGen Pro”
Thank you for this!
thanks a lot
Dude, this is a life saver!! I wasted half a day trying to figure out why the tool was making me the tool, this did the trick 🙂 Thanks man!!