cheap nfl jerseys china cheap nfl jerseys free shipping wholesale nfl jerseys china wholesale jerseys from china cheap nfl jerseys free shipping cheap nfl jerseys for sale cheap jerseys free shipping wholesale nfl jerseys from china cheap nfl jerseys sale cheap nike nfl jerseys china wholesale jerseys free shipping cheap nfl jerseys wholesale wholesale nfl jerseys online cheap nfl jerseys wholesale china jerseys wholesale cheap coach handbags outlet authentic designer handbags cheap coach handbags outlet cheap coach purses outlet discount coach bags coach bags sale coach purse outlet cheap real coach purses coach handbags sale online coach purse outlet michael kors outlet online store cheap michael kors bags cheap michael kors purse michael kors factory outlet online cheap michael kors handbags cheap michael kors purses michael kors bags outlet online cheap michael kors purse michael kors handbags discount cheap michael kors purse michael kors handbags discount
cheap nfl jerseys china cheap nfl jerseys free shipping wholesale nfl jerseys china wholesale jerseys from china cheap nfl jerseys free shipping cheap nfl jerseys for sale cheap jerseys free shipping wholesale nfl jerseys from china cheap nfl jerseys sale cheap nike nfl jerseys china wholesale jerseys free shipping cheap nfl jerseys wholesale wholesale nfl jerseys online cheap nfl jerseys wholesale china jerseys wholesale cheap coach handbags outlet authentic designer handbags cheap coach handbags outlet cheap coach purses outlet discount coach bags coach bags sale coach purse outlet cheap real coach purses coach handbags sale online coach purse outlet michael kors outlet online store cheap michael kors bags cheap michael kors purse michael kors factory outlet online cheap michael kors handbags cheap michael kors purses michael kors bags outlet online cheap michael kors purse michael kors handbags discount cheap michael kors purse michael kors handbags discount
stored procedures

elenco sintetico
elenco dettagliato

raccolta compilata di comandi SQL e istruzioni di controllo

aumentano la potenza, l'efficienza e la flessibilit� e migliorano le performances



creazione:

CREATE PROCEDURE utenti AS SELECT suid, uid, gid, name FROM sysusers
utenti


parametri:

CREATE PROCEDURE nomi @cognome varchar(40)
AS SELECT nome, cognome FROM anag WHERE cognome = @cognome
nomi Fontana


valori default:

CREATE PROCEDURE indici @table varchar(30) = NULL
AS IF @table IS NULL PRINT 'dammi una tabella'
ELSE SELECT sysobjects.name, sysindexes.name, indid FROM sysobjects, sysindexes WHERE sysobjects.name = @table AND sysobjects.id = sysindexes.id
indici autori

CREATE PROCEDURE indici2 @table varchar(30) = 'sys%'
AS SELECT sysobjects.name, sysindexes.name, indid FROM sysobjects, sysindexes WHERE sysobjects.name = @table AND sysobjects.id = sysindexes.id
indici2
indici2 autori


restituzione del valore di stato:

DECLARE @status int
EXECUTE @status = nomi @cognome = Fontana
SELECT status = @status

valore di stato generato dall'utente:

CREATE PROCEDURE nomi2 @cognome varchar(40)
AS IF (SELECT nome, cognome FROM anag WHERE cognome = @cognome) = 1
RETURN 1 ELSE RETURN 2

CREATE PROCEDURE nomi3 @cognome varchar(40)
AS DECLARE @retvalue int
EXECUTE @retvalue = nomi2 @cognome
IF (@retvalue = 1) PRINT 'esiste almeno un @cognome'
ELSE PRINT 'non esiste nessuno che si chiama @cognome'

nomi3 Fontana
non esiste nessuno che si chiama Fontana


restituzione valori ai paramentri:

CREATE PROC dividi @dividendo smallint, @divisore smallint, @quoziente int OUTPUT AS
IF @divisore = 0 BEGIN
        SELECT @quoziente = NULL
        RETURN -100
END
SELECT @quoziente = @dividendo / @divisore
RETURN 0

DECLARE @risultato int
DECLARE @status int
EXECUTE @status = dividi 64, 8, @risultato OUTPUT
SELECT @status, @risultato
0 8
EXECUTE @status = dividi 64, 0, @risultato OUTPUT
SELECT @status, @risultato
-100 NULL


altri esempi: