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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Question For Deleting All The Records By Using Date

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2007-02-26 : 10:17:28
Ashly writes "Hello,

I Am Using SqlServer2005,For Storing Th Records...........And I Am Using Jobs In sql Server Agent,For Deleting All The Records Except The Previous 1 Weak Record....
The Job Will Run For Once Every Weak.....I Need The Exact Query For Deleting All The Current Day Records...........

The DateTime Field In My Table Has Both The Date As Well As The Time....My Question Is I Need To Delete All The One day Records ......

For That I Used The Following Query,

Delete From Table_Name Where Field_Name =Select Min(Field_Name) From Table_Name


But It Is Not deleting All The Records..........

Basically I Am A C#.Net Programmer......But In My Project I Require Ths Query.....Can U please Guide Me.............If You can....."

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-26 : 10:27:35
[code]
delete d
from yourtable d
where d.datecol >= '20070226'
and d.datecol < '20070227'
[/code]


KH

Go to Top of Page
   

- Advertisement -