Answer Posted / chris fauvel
--Both use the dateadd function provided by t-sql, I'm sure
oracle and others have similar functions
--this way is a little slower and costlier
select *
FROM sys.tables
where modify_date between dateadd(yy, -5, getdate() ) and
dateadd(yy, -2, getdate() )
--this way is faster and less costly, by not doing the same
--function for every row.
declare @now datetime
, @then datetime
select @now = convert(datetime, convert(varchar, getdate()))
, @then = dateadd(yy, -5, @now)
Select *
from sys.tables
where modify_date between @then and @now
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
How do I setup a sql server database?
What is command parameter in ssrs?
What are different types of roles provided by ssrs?
What is the main difference between ‘between’ and ‘in’ condition operators?
Explain datetimeoffset data type in sal server 2008?
What are null values in ms sql server?
What is Command line parameters in PLSQL.?
What is stored in the mssqlsystemresource database? : sql server database administration
What are the differences between sql server and mysql.
What structure can you implement for the database to speed up table reads?
Hi, I Created 3 Tables Person(PersID[prkey],Name,Email,Password), Project(ProjName,ProjID[prkey],ProjLeader,ProjManager) & ProjectInvolvement(EntryDate,ProjID[frkey],PersID[frkey],ProjDuration). For this how can i INSERT,UPDATE & DELETE Through PROCEDURE? Please Post the Answer for me. Desai.
What is the difference between a check constraint and a rule?
List the different index configurations possible for a table?
What is clustered vs nonclustered index?
What are the different acid properties?