sql 代码获得当前时间日期

sql 代码获得当前时间日期
希望大家可以用select解答
getdate()函数如何与select联系写出直接打入不对
您好,存储过程里参数的默认值不能使用函数,旁银租所以不能在存储过搏念程里直接运兆把参数的默认值设置为当前系统时间,不过可以在存储过程里赋值。还有一点疑问,既然@myday是当前系统时间了,为什么还要做成参数呢?
create
procedure
pro_test
@myday
char(10)
as
set
@myday=convert(char(10),getdate(),21)
update
mytable
set
status
=
1
where
day>@myday
go
@myday不为参数时可以这么写
create
procedure
pro_test
as
declare
@myday
char(10)
set
@myday=convert(char(10),getdate(),21)
update
mytable
set
status
=
1
where
day>@myday
select getDate() as 当前时间
getdate()是MS SQL数据库系统的函数,如果用的其他数据库系统会报错的。
select getdate() as currentdate
晕,一个NOW();函数就解决了。
← 上一篇: 下一篇: →