AN event happens at a certain time of day SQL server 2008 R2

0

At 1 PM in a Game X a monster dies but it is programmed so that within three approximate hours it revives, or it departs at 3 PM. for example, but the time to revive is Variable DOES NOT HAVE A STILL TIME then

I got that:

DECLARE @horarevive int 
    SET @horarevive = 3

SELECT DATEADD(HOUR, @horarevive, GETDATE()) AS revirira

I need to make a select that detects the time "revivira" if the hour arrived or it passes of the hour example of it, but in days if this was every 3 days.

SELECT revirira FROM Table WHERE >= GETDATE ()-3 --esta sentencia debe detectar si murio hace mas de 3 dias o Mas 4,5,6,7,8 Infinito---> pero en Horas

I need to make the selection but in hours as it would be? to detect if I'm already revived because it's 3PM or a little bit more so that I can do something like this:

IF EXISTS (SELECT Hora FROM Table WHERE Hora >= 'aqui Desconozco que colocar de select tiempo de Hora')
BEGIN
Print 'Update Revivir consulta'
END

the time is variable, so the time of reappearance is different in each monster. I have a table where the time in which the monster must revive is reported.

Example: the monster dies on 04/10/2018 at 13 o'clock and relives 10 o'clock after it ends at 23 o'clock on 04/10/2018 and then at 23 o'clock with 15 o'clock it dies again to relive 9:15 of the day 05/10/2018 this info of death is in a Table that leaves the death of the Monster. in another is the time in which he revives. the question is how do I select the revival time column? is the format of the column is: 2018-10-04 13: 00: 00.767 I mean if I do this I can do it but the result would be Days and not the hours.

SELECT revivido FROM TABLE WHERE Columna <=GETDATE()-10

It comes out in 10 days and I need it in Hours.

    
asked by Juan Carlos Villamizar Alvarez 02.10.2018 в 03:15
source

0 answers