SQL 2005

i have a SQL 2005 server and i only know my way around the SQL server management studio. i have a table in a database that i right click on and choose "open table" and then i can see the data in that table. my goal is that i need to remove data that was create today ( 3/31 ) , i think if i highlight the entire table, then right click and choose, pane, and criteria - it looks like i can choose how to sort the table. then in the sort type column i have to right click and choose, pane, and criteria - then i can choose ascending, the next column is sort order and i only have 1 or unsorted as choices - i assume i choose 1. then the next column is group by - and it has to be count or count_big - so i choose count ( ? don't know if that is right ) - then there is a filter column - so i thought this is where i could put the column header that i want to sort ( ascending ) by. the column header i want to sort by is called DateCreated, i tried this but i get an error when i click on execute sql - ( i'm assuming i click on execute sql because i don't see anything else to click on.
so - does the above look like how i would sort my table by ascending date? or am i way off.
LVL 1
JeffBeallAsked:
Who is Participating?

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

x
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.

cyberkiwiCommented:
delete tblname
where datecreated >= '20110331'
  and datecreated < '20110401'

Open in new window


Run this query.  Replace "tblname" with the name of the table, i.e. the one that you click to "open table".

Where to run it:

In SSMS, right-click on the database server (2 levels up from the table name), choose "New Query".  On the right pane (big text area), paste the SQL code.
Press F5 to run it.

Now, "Open Table" again and you should see no more of today's data.
0
deightonprogCommented:
click on the SQL button then add to the end of the SQL

ORDER BY DateCreated DESC

then click on the exclamation button to re-run it.

Then highlight and delete the records with the recent date

You can execute delete SQL as above, but take care, if you get it wrong you can delete data you wanted by accident, I'm not saying that SQL is wrong though.
0

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
Alpesh PatelAssistant ConsultantCommented:
delete from tblname
where convert(varchar,datecreated,111) = '2010/03/31'
0
JeffBeallAuthor Commented:
thanks for the help
0
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
Microsoft SQL Server 2005

From novice to tech pro — start learning today.