Sto creando una funzione per restituire '0' o '1' a seconda del risultato delle istruzioni nidificate if else. Utilizzando MSSQL.Istruzione nidificata if else
ALTER FUNCTION udf_check_names_starting_with_quotationmark
(@string NVARCHAR(100))
RETURNS INT
AS
BEGIN
DECLARE @condition INT
SET @string = LTRIM(@string)
SET @string = RTRIM(@string)
IF (PATINDEX('"%', @string) !=0)
BEGIN
SET @condition = 1
END
ELSE IF (PATINDEX('%"%', @string) !=0)
BEGIN
SET @condition=1
END
ELSE IF (PATINDEX('%"', @string) !=0)
BEGIN
SET @condition = 1
END
ELSE
BEGIN
SET @condition=0
END
RETURN @condition
END
Tutto sta funzionando bene con questo. C'è un modo migliore per ottenere questo (ho provato a utilizzare OR ma editor SQL che mostra un errore, non riconoscendo l'OR).
Grazie? sei così tanto per questo aiuto .. Stavo giocando con Case ma non riuscivo a farlo funzionare, mio male .. Grazie .. –