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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -