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

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 create procedure for date

Author  Topic 

oracle_corrgi
Yak Posting Veteran

98 Posts

Posted - 2006-09-13 : 01:26:52
hi

SP with input parameters start_dte, end_dte, all


1.If end_dte is not specified, then need to take today’s date_time.
2.If start_dte is not specified, then need to take today’s date_time – 7 (to get data for last 7 days)
3.‘All’ Boolean parameter, if yes, then need to send all data available in the system from beginning till date.

thanxs



database

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-09-13 : 01:32:54
Have I missed something, or has this site become RentACoder????

:-(

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-09-13 : 01:49:00
quote:
Originally posted by oracle_corrgi

hi

SP with input parameters start_dte, end_dte, all


1.If end_dte is not specified, then need to take today’s date_time.
2.If start_dte is not specified, then need to take today’s date_time – 7 (to get data for last 7 days)
3.‘All’ Boolean parameter, if yes, then need to send all data available in the system from beginning till date.

thanxs



database



What do you have so far ?


KH

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-09-13 : 01:55:51
"2.If start_dte is not specified, then need to take today’s date_time – 7 (to get data for last 7 days)"

Sounds pretty vague to me. 7 days from THE CURRENT TIME 7 days ago, or from midnight?

And clearly Point 3 should be the First Point, otherwise it will never get executed. I actually think that an ALL parameter is nuts - the application can just set the start_dte to some ridiculously early date.

Kristen
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-09-13 : 01:56:59
Should I refer to the "_dte" suffix as reverse-Hungarian-notation?

Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-09-13 : 10:40:09
quote:
Originally posted by oracle_corrgi

hi

SP with input parameters start_dte, end_dte, all


1.If end_dte is not specified, then need to take today’s date_time.
2.If start_dte is not specified, then need to take today’s date_time – 7 (to get data for last 7 days)
3.‘All’ Boolean parameter, if yes, then need to send all data available in the system from beginning till date.

thanxs



database



You might want to read about the GETDATE, DATEADD, and DATADIFF functions in Sql Server Books Online.

If you need additional info, you may want to look through this:
Date/Time Info and Script Links
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=64762




CODO ERGO SUM
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-09-13 : 12:08:34
Also Learn SQL

http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -