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.
Who is Participating?
click on the SQL button then add to the end of the SQL


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

All Courses

From novice to tech pro — start learning today.