Créer une PROC STOCK si elle n'existe pas.
Bonjour,
Je cherche ecrire un script en transact SQL qui crée une procédure stocké si elle n'existe pas et qui ne fait rien sinon.
J'ai essayé ça :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MA_PROC]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
BEGIN
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE [DBO].[MA_PROC]
@VAR1 NVARCHAR(100),@VAR2 NVARCHAR(250)
AS
...
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
END |
Mais sans succès...
EDIT pour précision : je suis sous SQL Server 2000