SQL Server see which time is greater -
i need pull time field in existing table stored smalldatetime.
an example of value stored follows:
jun 4 1900 11:30am
i need grab time part (hours , minutes) , see if less whatever current time now.
eg if @cutofftime < @currenttime begin .... end
is there easy way in sql server? thanks!
you can cast datetime
time, along time getutcdate()
, , compare:
declare @timea smalldatetime; set @timea = 'jun 4 1900 11:30am' if cast(@timea time) < cast(getutcdate() time) begin print 'time earlier current time' end
Comments
Post a Comment