Home Forums SQL Server 2008 SQL Server Newbies Using a Temporary Table in a View in Order to Combine three Queries RE: Using a Temporary Table in a View in Order to Combine three Queries

  • matt_garretson (7/23/2013)


    This is great!!! Thanks!!! I just tried to run this and yes, it takes a long time. If I wanted to turn this into a stored procedure how would I go that? I also need to use a user defined function so pulling from the queries below where CLT_NBR in (select clt_nbr from ufn_WFR_Enrolled_Clients_List ('2012-07-01', '2013-06-30')) Can one apply a unset defined function to a stored procedure?

    You would just add something along these lines at the start of the altered code you've been given:

    CREATE PROC procName

    @from_dt DATETIME,

    @to_dt DATETIME

    AS

    Yes, you can refer to a UDF within a Stored Procedure.