Section courante

A propos

Section administrative du site

ALTER FUNCTION

#NAMEDEF#
  Microsoft SQL Server

Syntaxe

ALTER FUNCTION [ schema_name. ] function_name
( [ { @parameter_name [ AS ][ type_schema_name. ] parameter_data_type
[ = default ] }
[ ,...n ]
]
)
RETURNS return_data_type
[ WITH function_option [ ,...n ] ]
[ AS ]
BEGIN
function_body
RETURN scalar_expression
END
[ ; ]
Syntaxe de la fonction scalaire Transact-SQL
ALTER FUNCTION [ schema_name. ] function_name
( [ { @parameter_name [ AS ] [ type_schema_name. ] parameter_data_type
[ = default ] }
[ ,...n ]
]
)
RETURNS TABLE
[ WITH function_option [ ,...n ] ]
[ AS ]
RETURN [ ( ] select_stmt [ ) ]
[ ; ]
Syntaxe de la fonction de valeur de table en ligne Transact-SQL
ALTER FUNCTION [ schema_name. ] function_name
( [ { @parameter_name [ AS ] [ type_schema_name. ] parameter_data_type
[ = default ] }
[ ,...n ]
]
)
RETURNS @return_variable TABLE table_type_definition
[ WITH function_option [ ,...n ] ]
[ AS ]
BEGIN
function_body
RETURN
END
[ ; ]
Syntaxe de la fonction de valeur table Transact-SQL Multistatement
function_option::=
{
[ ENCRYPTION ]
| [ SCHEMABINDING ]
| [ RETURNS NULL ON NULL INPUT | CALLED ON NULL INPUT ]
| [ EXECUTE_AS_Clause ]
}

table_type_definition:: =
( { column_definition column_constraint
| computed_column_definition }
[ table_constraint ] [ ,...n ]
)
column_definition::=
{
{ column_name data_type }
[ [ DEFAULT constant_expression ]
[ COLLATE collation_name ] | [ ROWGUIDCOL ]
]
| [ IDENTITY [ (seed , increment ) ] ]
[ column_constraint [ ...n ] ]
}

column_constraint::=
{
[ NULL | NOT NULL ]
{ PRIMARY KEY | UNIQUE }
[ CLUSTERED | NONCLUSTERED ]
[ WITH FILLFACTOR = fillfactor
| WITH ( index_option [ , ...n ] )
[ ON { filegroup | "default" } ]
| [ CHECK ( logical_expression ) ] [ ,...n ]
}

computed_column_definition::=
column_name AS computed_column_expression

table_constraint::=
{
{ PRIMARY KEY | UNIQUE }
[ CLUSTERED | NONCLUSTERED ]
( column_name [ ASC | DESC ] [ ,...n ] )
[ WITH FILLFACTOR = fillfactor
| WITH ( index_option [ , ...n ] )
| [ CHECK ( logical_expression ) ] [ ,...n ]
}

index_option::=
{
PAD_INDEX = { ON | OFF }
| FILLFACTOR = fillfactor
| IGNORE_DUP_KEY = { ON | OFF }
| STATISTICS_NORECOMPUTE = { ON | OFF }
| ALLOW_ROW_LOCKS = { ON | OFF }
| ALLOW_PAGE_LOCKS ={ ON | OFF }
}
Syntaxe de clauses de fonction Transact-SQL
ALTER FUNCTION [ schema_name. ] function_name
( { @parameter_name [AS] [ type_schema_name. ] parameter_data_type
[ = default ] }
[ ,...n ]
)
RETURNS { return_data_type | TABLE clr_table_type_definition }
[ WITH clr_function_option [ ,...n ] ]
[ AS ] EXTERNAL NAME method_specifier
[ ; ]
Syntaxe des fonctions CLR scalaire et table
method_specifier::=
assembly_name.class_name.method_name


clr_function_option::=
}
[ RETURNS NULL ON NULL INPUT | CALLED ON NULL INPUT ]
| [ EXECUTE_AS_Clause ]
}

clr_table_type_definition::=
( { column_name data_type } [ ,...n ] )
Syntaxe de clauses de fonction CLR
ALTER FUNCTION [ schema_name. ] function_name
( [ { @parameter_name [ AS ][ type_schema_name. ] parameter_data_type
[ NULL | NOT NULL ] [ = default ] }
[ ,...n ]
]
)
RETURNS return_data_type
[ WITH function_option [ ,...n ] ]
[ AS ]
BEGIN ATOMIC WITH (set_option [ ,... n ])
function_body
RETURN scalar_expression
END

function_option::=
{ | NATIVE_COMPILATION
| SCHEMABINDING
| [ EXECUTE_AS_Clause ]
| [ RETURNS NULL ON NULL INPUT | CALLED ON NULL INPUT ]
}
Syntaxe pour OLTP en mémoire: fonction scalaire compilée en mode natif

Description

Cette instruction permet de modifier une transaction SQL existante ou une fonction CLR étant précédemment créé par une instruction CREATE FUNCTION.



Dernière mise à jour : Vendredi, le 19 Juin 2020