Date Math In SQL Server, Number of Days Elapsed Since Date In Table

I am fairly new to SQL Server, working in SQL Developer 14.

I have a requirement to pull records from a table after a specified number of days has passed.

I have a lot of experience in MS Access and I could accomplish this in an Access query using the Date Function.  'TableDate' is the field containing the date.  If I wantto make sure at least 30 days have passed:

Select .....
From ....
Where Date - TableDate > 30

Is there a way to do something similar in a SQL Select?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pawan KumarDatabase ExpertCommented:
Please try like this-

DateDiff function.

FROM YourtableName

Open in new window

OR this

FROM YourtableName
WHERE TableDate > CAST((GETDATE() - 30) AS DATE)

Open in new window

PortletPaulEE Topic AdvisorCommented:
Always choose a method that does NOT require a function on the data. There are many reasons for this
 * in most cases it removes the ability to use an index on the column being amended (makes the query slower)
 * requires a function call on every row, quite unnecessarily

please choose this approach:

FROM YourtableName
WHERE TableDate > CAST((GETDATE() - 30) AS DATE)

notice that it doesn't alter the table data, instead it does just one calculation

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mlcktmguyAuthor Commented:
Thanks for the comments and suggestions, they are very much appreciated.  I took some time off over the holiday so I have not had time to evaluate them yet.
mlcktmguyAuthor Commented:
Thank You
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.