22 lines
594 B
Transact-SQL
22 lines
594 B
Transact-SQL
CREATE PROCEDURE [dbo].[sp_updateClienteReportLastAccess]
|
|
@idReport as int,
|
|
@IdCliente as int
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
declare @found as int
|
|
select @found = count(*) from [dbo].[ReportPerCliente] where IdCliente = @idCliente and IdReport = @idReport
|
|
if(@found > 0)
|
|
UPDATE [dbo].[ReportPerCliente]
|
|
SET DtAssociazione = getdate()
|
|
WHERE IdCliente = @idCliente and IdReport = @idReport
|
|
else
|
|
INSERT INTO [dbo].[ReportPerCliente]
|
|
([DtAssociazione]
|
|
,[IdReport]
|
|
,[IdCliente])
|
|
VALUES
|
|
(getdate()
|
|
,@idReport
|
|
,@idCliente)
|
|
END |