Using temporary tables or table variables in SP

3 posts, 1 answers
  1. Mateusz
    Mateusz avatar
    11 posts
    Member since:
    Jul 2012

    Posted 06 Apr 2013 Link to this post

    Hi,

    I have encountered a little problem and i would be glad to receive some help.
    If I create a stored procedure like this:
    CREATE PROCEDURE [dbo].[Telerik] (@ID INT)
    AS
    BEGIN
     
    IF(OBJECT_ID('tempdb..#tmp') IS NOT NULL)
    BEGIN
        DROP TABLE #tmp
    END
     
    CREATE TABLE #tmp
    (
    ID INT
    )
     
    INSERT INTO #tmp
        SELECT @ID
         
    SELECT * FROM #tmp
     
    END
    GO
     
    EXEC [dbo].[Telerik]  229

    result will be quite obvious (it is just a sample to show You my problem).

    Now, if I use this stored procedure as a data source command in Telerik Report Designer, it will of course show me the right result in window called "Preview Data Source Results"  but as soon as I click "Finish" button it will not display ANY columns in Data Explorer. Same story happens if I use table variable instead of tmp table. Question is, how can I get columns list in Data Explorer if I'm using tmp table or table variables in stored procedure ? Without it, it is a bit difficult to design anything, as every time I have to create procedure with simple select and proper column names, create data source command based on that procedure, and after that I am changing my procedure to "normal" code (column list in data explorer does not change in this situation). 

    How can i avoid this ?

    All the best,
    Mateusz
  2. DevCraft banner
  3. Mateusz
    Mateusz avatar
    11 posts
    Member since:
    Jul 2012

    Posted 15 Apr 2013 Link to this post

    Hi :)

    I would like to thank You for your help - after reading linked topic, problem can be marked as solved.

    All the best,
    Mateusz
Back to Top