Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 User Input for dates using Between

Author  Topic 

JoelDC
Starting Member

1 Post

Posted - 2013-01-10 : 15:15:11
I am trying to get a box prompting users for input when they run the following equation:


SELECT d.shiftindex, d.loc, d.timeempty, d.timedump, d.ddbkey
FROM dbo.hist_dumps d Inner Join dbo.hist_exproot e
On d.shiftindex = e.shiftindex
WHERE e.shiftdate between [startdate] and [enddate]

I have not been able to come up with a way to get the start date and end date to be requested.

This query is on SQL management studio 2005

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2013-01-10 : 15:46:36
There is no way to prompt a user for input in SSMS.

But you can use variables:

declare @startdate datetime
declare @enddate datetime
set @startdate='20130101'
set @enddate ='20130131'

select ... where ... between @startdate and @enddate

But sorry - no prompting...


Too old to Rock'n'Roll too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-10 : 22:34:28
the prompting part has to be done at some front end tools

or create logic as a procedure with parameters and right click and select execute option. it will give a pop up screen for parameters

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -