Function for Using Now instead of GetDate in SQL Server 2012 -
i use now() current date , time, trying create function, cannot syntax right
use [db1] go set ansi_nulls on go set quoted_identifier on go create function [dbo].[now]() returns [date] begin declare @now1 select getdate() -- return result of function return @now1 end any appreciated.
you don't need create own function current date, can use
select getdate() just kidding :) imagine want more returning current date
type body way:
declare @now1 datetime select @now1 = getdate() so full code should be
use [db1] go set ansi_nulls on go set quoted_identifier on go create function [dbo].[now]() returns [datetime] begin declare @now1 datetime select @now1 = getdate() return @now1 end
Comments
Post a Comment