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 2008 Forums
 Transact-SQL (2008)
 query help

Author  Topic 

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2011-12-06 : 11:00:40
[code]

datevalue
-----------
12/11/09 24:25:55
12/08/09 14:25:55
11/11/09 24:25:55
10/08/09 11:25:55


i want a query which should result the output

datevalue
-----------
12/11/09 00:25:55
12/08/09 14:25:55
11/11/09 00:25:55
10/08/09 11:25:55

[/code]

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-06 : 11:06:03
whats the datatype of datevalue field?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2011-12-06 : 11:15:37
Datatype is varchar
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-06 : 11:54:45
then use replace

UPDATE table
SET datevalue = REPLACE(datevalue,' 24:',' 00:')


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-12-07 : 03:21:18

This is why you should always use proper datetime datatype to store correct date values

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -