Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL Server
Expertise: Beginner
Oct 8, 1999

Parameter Setting

Question:
I need to know how to write SQL to ask for a date range and run the query on that range. Can you help me?

Answer:
I think it makes the most sense to structure your job as a procedure, then you'll at least have the benefit of declaring the @startdate and @enddate that are the case for your query.

Next, you'll need to apply the BETWEEN predicate to limit the result set; words to the effect "WHERE mydate BETWEEN(@startdate,@enddate)" should do it for you.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date