﻿create table RemoteRebootLog(
  idxReboot   int           not null identity constraint PK_RemoteRebootLog primary key,
  IdxMacchina nvarchar(50)  not null,
  IPv4        nvarchar(50),
  Agent       nvarchar(250),
  DataOraBoot datetime
);
go


set xact_abort on;
go

begin transaction;
go

set ANSI_NULLS on;
go

/*************************************
* STORED PROCEDURE stp_TC_getByMacchinaPeriodo
* 	recupera tempi ciclo x macchina e periodo
*
* modif.:	S.E.L. - 2010.12.15
**************************************/
alter PROCEDURE stp_TC_getByMacchinaPeriodo
(
	@IdxMacchina NVARCHAR(50),
	@Inizio DATETIME,
	@Fine DATETIME
)
AS

SELECT	* FROM TempiCicloRilevati
WHERE	IdxMacchina = @IdxMacchina AND
		(DataOraRif >= @Inizio) AND (DataOraRif <= @Fine) 
ORDER BY DataOraRif		

RETURN
go

/*************************************
* STORED PROCEDURE stp_TRI_getByIdxMacchina
* 	recupera dati transizione ingressi da idx Macchina
*
* modif.:	S.E.L.
* il:		2011.03.23
**************************************/
alter PROCEDURE stp_TRI_getByIdxMacchina
(
	@IdxMacchina NVARCHAR(50)
)
AS

SELECT *
FROM TransizioneIngressi
WHERE IdxFamigliaIngresso = (SELECT IdxFamigliaIngresso FROM Macchine2FamigliaIngressi WHERE IdxMacchina=@IdxMacchina)


RETURN
go

commit;
go








-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(390, GETDATE())
GO

SELECT  TOP 10 * FROM LogUpdateDb ORDER BY Versione DESC
GO