叫声爸爸不容易,领主大人安好,秀爱组合
直接上代码:
create function unix_timestamp (@ctimestamp datetime) returns integer as begin /* function body */ declare @return integer select @return = datediff(second,{d '1970-01-01'}, @ctimestamp) return @return end create function from_unixtime (@ts integer) returns datetime as begin /* function body */ declare @return datetime select @return = dateadd(second, @ts, {d '1970-01-01'}) return @return end
用法
跟mysql下的一样类似:
select dbo.unix_timestamp('2013-1-1') select dbo.from_unixtime(2145000000)
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
数据库SQL---数据库、基本表、视图、索引的定义、修改、删除
在 Azure CentOS VM 中配置 SQL Server 2019 AG - (上)
在 Azure CentOS VM 中配置 SQL Server 2019 AG - (下)
网友评论