Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-05-03 : 10:39:55
|
| Adrian writes "I have recently populated a table with records and i need to delete the recent records form the table. I would like to delete the records by date. e.g from 01/01/2004 to 01/04/04 (date is in small date time format) Can you knidly explain how to do it and possibly the SQL statement that i need to use." |
|
|
gpl
Posting Yak Master
195 Posts |
Posted - 2004-05-03 : 11:02:06
|
| AdrianFirstly, you should look up Books OnlineSecondly, you want to use the delete commandI am assuming that you have a column on your table that holds the creation date, your SQL would look something like -Delete MyTableWhere CreationDate Between StartDate and EndDate-- if I am not 100% sure that I am deleting the corrct rows, I apply the where clause to a select to ensure that the returned rows are the ones I want to remove.If you are saying that you want to delete the rows you added between those dates and there is nothing on the row to indicate when they were added, then Im afraid you are out of luck, unless you still have access to the source data that you inserted, in which case it might be possible to identify these rows and selectively delete them.Graham |
 |
|
|
|
|
|