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
 General SQL Server Forums
 New to SQL Server Programming
 how to find total date

Author  Topic 

Angela4
Starting Member

6 Posts

Posted - 2012-06-21 : 20:17:33
I have 1 table will keep user 'Createdatetime', i want to create a script to different out which people register their account already 7days, 14days and 21days?

For those user on that 3 day.. i want to able enter some condition in the script..

Eg:
if Createdatetime = 7days then do xxx;
elseif Createdatetime = 14days then do yyy;
elseif =21days then do zzz.
end if

Anyone know how to create script like this??

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-06-21 : 20:26:49
sounds like a set of if ...else statements

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Angela4
Starting Member

6 Posts

Posted - 2012-06-21 : 20:29:28
yes, use if.. else statement is needed on that.
but my problem is.. i don't know how to count the exact day from 'Createdatetime'?
i only want to step in the condition when the day is 7,14 or 21 days..
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-06-21 : 20:31:07
use datediff(dd,createdatetime,getdate()) = 7 etc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -