Click here to Skip to main content
15,901,666 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Good Morning Every One......

Can any one help me to write a stored procedure to get last seven dates from current date ...

I want to show this into a dropdown list... I havn't get any idea about this...

Sorry for bad spelling or bad grammer...
Posted

1 solution

Use this query to get last 7 dates:

SQL
select
dateadd(day,datediff(day,0,getdate()),-number) as BackDate from
(
select top 7 row_number() over (order by name) as number from sysobjects
) as t
 
Share this answer
 
Comments
khursheed Alam786 12-Jul-13 7:22am    
Thanks jaideep...........
plz help me one more way..i have a table with column complaintdays...that means what ever user set a value in that column so the dropdown should show that number of days...
jaideepsinh 12-Jul-13 7:46am    
I don't understand what you want to do can you explain in brief.
khursheed Alam786 17-Jul-13 5:40am    
Thanks jaideep...I have solved it from my own....actually I have a project called transportmanagement system in which if user want to complain about any bus driver so he should complain from current date to previous one week dates....that's why I have asked this question....thanks once again for your help.. :)
jaideepsinh 17-Jul-13 5:45am    
Your welcome.Pls vote and accept as answer by the way where you from and for whom you develop this project.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900