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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 User Input for dates using Between
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 01/10/2013 :  15:15:11  Show Profile  Reply with Quote
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

Flowing Fount of Yak Knowledge

8781 Posts

Posted - 01/10/2013 :  15:46:36  Show Profile  Visit webfred's Homepage  Reply with Quote
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

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 01/10/2013 :  22:34:28  Show Profile  Reply with Quote
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

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000