Thursday, January 20, 2011

LINQ and #Temporary tables in Stored Procedure do not have return values

I have Stored Procedure which include #tmp table. I tried to drag it to DBML but every time i got message "bla-bla-bla ... do not have return values...".After countless attempts was found solution! (Thanks to Marc Gravell )
Replace the #tmp in variable, a meaning:

CREATE TABLE #tmp (Item in)
Replace it to:
DECLARE @tmp TABLE (Item int)

A using in query is:
SELECT yt.*, t.Item
FROM YUOR_TABLE yt, @tmp t


Enjoy!