• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

records more than 30 days using tsql using sql 2005

i have a table name filekeywords data structure

[filename] [varchar](255) NOT NULL,
      [filedescription] [varchar](2000) NOT NULL,
      [datecreated] [datetime] NOT NULL,

i want to get all the records that are older than 30 days. date is stored under datecreated.

can someone help me out.
2 Solutions
Aneesh RetnakaranDatabase AdministratorCommented:

SELECT * FROM tablename WHERE [datecreated] < CONVERT(VARCHAR, GETDATE()-30, 112)
select * from filekeywords
where datecreated < dateadd(day, -30, getdate())
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now