set xact_abort on;
go

begin transaction;
go

set ANSI_NULLS on;
go

/*****************************************
* STORED stp_particolariByConditioValue
*
* Cerca particolari x conditio (tipo particolare) e valore (codice particolare)
*
* Steamware, S.E.L.
* mod: 2013.11.25
*
****************************************/
create PROCEDURE stp_particolariByConditioValue
(
	@value NVARCHAR(50),
	@conditio NVARCHAR(50) = '*' -- tipo particolare, se '*' = TUTTI altrimenti A/P
)
AS

IF ( @conditio IS NOT NULL AND @conditio <> '*' )
    SELECT	*
    FROM v_selParticolari
     WHERE conditio = @conditio
        AND value = @value;
ELSE
    SELECT	*
    FROM v_selParticolari
     WHERE value = @value;

RETURN
go

commit;
go




-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(571, GETDATE())
GO
SELECT TOP 5 * FROM LogUpdateDb ORDER BY Versione DESC
GO
