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)
 conversion datetime

Author  Topic 

satya068
Posting Yak Master

233 Posts

Posted - 2010-05-27 : 03:45:02
Hi..

sorry guys actually i posted the wrong script..in the previous post...hergo my query.
in my table ther is RUN_DATE column which is getdate()

SELECT RECORD_COUNT.TABLE_NAME,RECORD_COUNT.ROW_COUNT,INSERT_COUNT.NO_OF_INSERTS,UPDATE_COUNT.NO_OF_UPDATES, getdate() as RUN_DATE
INTO TOTAL_RECORD_COUNT

after executing my SP in the RUN_DATE column, the datetime format is
27/05/2010 08:30:00 whic is time that i executed my SP
here i need to set the time to 27/05/2010 00:00:00,the reason is in case if executed the SP twice in a single day on diffrent times ther will be 2 sets of data in the table,but i need the data to overwrite insted of creating twice.

would you have any idea about this pls?

thanx

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-05-27 : 04:35:48
To get it with time part 00:00:00 use this:

dateadd(d,datediff(d,0,getdate()),0)


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

satya068
Posting Yak Master

233 Posts

Posted - 2010-05-27 : 04:47:48
thanx fred...

Satya
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-05-27 : 05:00:21
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -