Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2004
    Posts
    74

    Unanswered: Using only one dataset

    Hey,

    I am using the following stored procedure, but as it is now it returns 2 datasets. I need it to return only 1.

    ALTER PROCEDURE dbo.Test2
    (
    @Location varchar(250),
    @FromDate datetime,
    @ToDate datetime
    )

    AS
    SET NOCOUNT ON

    CREATE TABLE #Temp1 (themonth varchar(12), theyear varchar(12), averagedaystofilltotal float, averagefillratetotal float,
    delaytimetotal float, responsetimelagtotal float)

    INSERT INTO #Temp1(themonth, theyear, averagedaystofilltotal, averagefillratetotal, delaytimetotal, responsetimelagtotal)
    EXEC rptStatsGraphicalYEARoverYear @Location, @FromDate, @ToDate

    Create table #Temp2(averagedaystofilltarget float, averagefillratetarget float, responsetimelagtarget float)
    INSERT INTO #Temp2(averagedaystofilltarget, averagefillratetarget, responsetimelagtarget)
    EXEC Test1

    SELECT * FROM #Temp1
    Select * from #Temp2

    drop table #Temp1
    drop table #Temp2

    Would anyone have any suggestions on how to modify this procedure so that it returns only one dataset, but yet still keeps the data seperated? Or is this even possible?


    Thanks

  2. #2
    Join Date
    Dec 2004
    Location
    Kharkov, Ukraine
    Posts
    40
    Which queries you need? First or second?

  3. #3
    Join Date
    Dec 2004
    Posts
    74
    Both queries

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Returns one recordset, but keeps the data separated? I suppose you want to eat your cake and have it too? You realize how little sense that makes, I hope?

    Your only possibility is if the output format of the two querys is identical, or can be made identical. In that case, you can use a Union query with an additional field created to indicate the dataset:

    SELECT 'Temp1' as dataset, * FROM #Temp1
    UNION
    Select 'Temp2' as dataset, * from #Temp2
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •