Re: Promt user for criteria ?



On Fri, 20 Jan 2006 07:36:05 -0800, Xavier wrote:

>I know it can be done with a SP but is there a way to prompt a user for
>specific criteria like date range (between ? and ?) in a view.
>I have a query in a view but I need to prompt the user for a date range, my
>front end is access 2002 I can do it as a passthrough but it takes to long to
>run and while testing I found that as a view it runs in half the time.

Hi Xavier,

SQL Server can't ever prompt the user. Not in a view, and not in a
stored procedure either.

If you refer to prompting for arguments in the front end, then passing
them as parameters to the back end: that is possible in stored procs,
but not in a view. But you can use variables in a SELECT statement that
queries a view.

However, I am intrigued by your statement that you found a view to be
faster than a stored procedure. While I don't doubt your observations,
I'm pretty sure that there's no such blanket statement about performance
of views vs stored procedures. I suspect that is has something to do
with the specific details of your tables, your stored procedure and your
view.

To investigate this further, you'll have to give more details: how do
your tables look (CREATE TABLE statements), how are the view and the
stored procedure defined (CREATE VIEW / CREATE PROC), what does your
data typically look like (INSERT statements for a small sample of your
data) and how do you call the view and the stored proc?

Chcek out www.aspfaq.com/5006 for some tips on how to assemble this
information.

--
Hugo Kornelis, SQL Server MVP
.



Relevant Pages

  • RE: SQL prompt for input
    ... I learned that you want to prompt the user to input the parameters for the ... stored procedure with parameters in Access Project to meet your ... select * from customers ... When you double click this Stored Procedure, ...
    (microsoft.public.access.queries)
  • Re: SELECT INTO FOR XML AUTO workaround
    ... XML is for transfer between data sources. ... I'd say:) I allready have the stored procedure ... for calling that same stored procedure from within the SQL server. ... > If you just want to share data between stored procs then this article ...
    (microsoft.public.sqlserver.programming)
  • Help! Date Calendar Stored Procedure
    ... I'm using Crystal 8.5 and SQL Server 2000 stored procedure where I currently ... prompt for a text field which I then convert to a datetime variable to run ... I would like Crystal to display the Date Calendar ... What datatype or what trick can I use so that when my report runs, ...
    (microsoft.public.vb.crystal)
  • Output to
    ... data source is a stored procedure that requires a ... rather than prompt the user to enter it via a keyboard ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Pass-thru SQL performance vs Stored Proc
    ... >> are going to have to create a lot of dynamic SQL based on user selects ... > stored procedure per permutation of parameters, ... > ms per execution, and you are executing it 100 times an hour, no problem, a ... Right now all our code is in stored procs. ...
    (microsoft.public.sqlserver.programming)