prompting for values when opening a view

  • I 'm working on a view, which has to sort the data from certain periods..

    => only data that is found for the period starting on DateA and ending on DateB                                        is there a function in SQL Server that makes this possible? 

    for instance, the original DBase we've been working with, is in MS Acces and solves it like this:           Between [DateA] And [DateB]

    at the opening of the query, you get two prompts that ask for these dates, so the sql code can use it later on.

  • Stored Procedures might help you : )

    SQL Server <> Access

     

     


    Kindest Regards,

    Vasc

  • You should use stored procedure

    for example:

    create procedure getData

    (@dateBegin datetime,@dateEnd datetime)

    as

    begin

    select name,address,birthdaydate from tblX

     where birthdaydate between @dateBegin  and @dateEnd

     

    end

     

    execute getData '1980-01-01','1981-01-01')

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply