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 |
kiddofatso
Starting Member
5 Posts |
Posted - 2014-10-07 : 02:13:27
|
Hi Everyone......while using following function I am getting this Error "Msg 195, Level 15, State 10, Line 1'DATE' is not a recognized built-in function name."select callid, DATE(segstart) AS calldatefrom October_CLI.dbo.rawWhere callid >0 Segstart Column = Data with call date & timeCallid Column = Unique Call IdOctober_CLI.dbo.raw = TableCalldate = Where i want the only date to be capture from segstart column |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2014-10-07 : 02:35:42
|
Try this:select callid, DATEADD(dd, 0, DATEDIFF(dd, 0, segstart)) AS calldatefrom October_CLI.dbo.rawWhere callid >0 Harsh Athalyehttp://in.linkedin.com/in/harshathalye/ |
|
|
kiddofatso
Starting Member
5 Posts |
Posted - 2014-10-07 : 02:38:09
|
It works thanks a ton |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2014-10-07 : 06:48:50
|
[code]SELECT CallID, CAST(SegStart AS DATE) AS CallDateFROM [October_CLI].dbo.[Raw]WHERE CallID > 0;[/code] Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2014-10-07 : 07:03:57
|
quote: Originally posted by SwePeso
SELECT CallID, CAST(SegStart AS DATE) AS CallDateFROM [October_CLI].dbo.[Raw]WHERE CallID > 0; Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
That will work assuming database is on SQL Server 2008 or later version.Harsh Athalyehttp://in.linkedin.com/in/harshathalye/ |
|
|
|
|
|
|
|