We help IT Professionals succeed at work.
Get Started

how to get date range in the stored procedure

SayYou_SayMe
SayYou_SayMe asked
on
833 Views
Last Modified: 2012-05-09
the buiness requirement is that
pass the date range from .net to the stored procedure in Sybase to select these date range records

for example , product table

id  product_name  date
1   monitor           01/29/2010
2   driver              12/01/2008

created a stored procedure :
create procedure search_product
@date_from datetime,
@date_to datetime
as
begin
select product_name, date from product
where convert(char(10),date,101)>convert(char(10),@date_from,101)
and convert(char(10),date,101)<convert(char(10),@date_to,101)

but it does not work , can not get the expected result
any idea?

thanks
Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 10 Answers and 12 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE