SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

JoelDC
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

webfred
Flowing Fount of Yak Knowledge

Germany
8768 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

visakh16
Very Important crosS Applying yaK Herder

India
52325 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
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.05 seconds. Powered By: Snitz Forums 2000