Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How will u get 5 years back record?

Answer Posted / chris fauvel

--crap made a booboo
--corrected code here
--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
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 ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the differences between stored procedure and the dynamic sql?

1030


How to rebuild the master database?

1014


What is the difference between MVC and Teir Architecher? Plz explain with Layyered Programming example...? Thanks

1991


How to list all login names on the ms sql server?

1081


How can I tell if sql server is 32 or 64 bit?

904


You have developed an application which uses many stored procedures and triggers to update various tables users ocassionally get locking problems which tool is best suited to help you diagnose the problem?

956


Is it possible to import data directly from t-sql commands without using sql server integration services? If so, what are the commands?

1325


Explain what are the restrictions that views have to follow? : SQL Server Architecture

993


Explain the properties of sub-query in sql server?

956


What is temporary table in sql server? Why we use temp table?

909


What is the difference between index seek vs. Index scan?

974


How can you list all the table constraints in a database?

885


How to set database to be read_only in ms sql server?

957


 Explain what is sql override for a source taLle in a mapping?

947


Tell me extended events in sql server 2008?

951