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
 General SQL Server Forums
 New to SQL Server Programming
 Questions about DATETIME conversion

Author  Topic 

coolbear91
Starting Member

2 Posts

Posted - 2014-02-04 : 22:48:12
Hi guys,

Since I'm new in SQL, kindly need your help regarding to my problems.
I have two questions about date formatting in MS SQL 2008.

1. I have column name called DATETIME which have the value like this: 2013-11-12 05:00
what function should I have to use to get only 05:00?

2. I have some rows as below picture:


how can I get the maximum value of "Active PDP Context" and the Time column becomes only 2014-02-03 00:00:00.000?

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2014-02-05 : 08:40:14
you want to pull only the Time part?

Javeed Ahmed
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2014-02-05 : 12:28:05
SELECT CONVERT(CHAR(8), Col1, 8) FROM dbo.Table1


Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page
   

- Advertisement -