Re: Creating a view within a stored procedure

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Anith Sen (anith_at_bizdatasolutions.com)
Date: 05/07/04


Date: Fri, 7 May 2004 10:22:21 -0500

You can simply have the 2 SELECT statements with the UNION in the stored
procedure itself & call the stored procedure from the report-writer. Based
on your narrative, there no need for a #temp table or a view.

CREATE PROC usp @dt DATETIME
AS
SELECT ... FROM
UNION
SELECT ... FROM

-- 
Anith


Relevant Pages

  • Re: Changed fields
    ... Will I have to do a union for each field in the table? ... I'm looking for a generic way to do this so the trigger ... >> In our applications we have a table named ChgMstr ... >> ChgMstr table or call a Stored Procedure to do it. ...
    (microsoft.public.sqlserver.server)
  • Union results of recursive stored procedure and temp table concurr
    ... Also, I tried doing a union using my recursive procedure, but I can't union a SQL query and the results of a stored procedure. ... DECLARE @some_UID int, @parent_UID int, @ordering_attribute int ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Stored Procedure that returns multiple recordsets
    ... If you know how to do this right in the report, ... > This is kinda funky but I avoid using subreports by using union ... > Customers.CustomerID, Customers.CustomerName From Customers ... If I have a stored procedure that returns multiple recordsets, ...
    (microsoft.public.vb.crystal)
  • Re: Nest stored procedure accessing parent objects
    ... SELECT * FROM #blat ... UNION SELECT 2 ... > I recently attended the MOC class 2073A Programming a Microsoft SQL Server ... > "If one stored procedure calls a second stored procedure, ...
    (microsoft.public.sqlserver.programming)
  • Re: union operator with sps
    ... union all clause works only with SELECT statements. ... --merging two row sets from sp_who stored procedure by temporarily sending ... from openquery (, 'exec sp_who') ...
    (microsoft.public.sqlserver.programming)