SELECT [dbo].Circle(5) AS Area
There is no standard way to run a function in SQL Server.
However, some common methods are to use a stored procedure or to use the Execute command.
//the syntax to create a function with input parameters:
CREATE FUNCTION function_name(input_parameter)
RETURNS return_type
AS
BEGIN
DECLARE
--Local Variables to be declared--
--SQL statements--
RETURN return_value
END
//example :
CREATE FUNCTION [dbo].Circle(@Radius int)
RETURNS real
AS
BEGIN
DECLARE
@Area real
SET @Area=3.14*@Radius*@Radius
RETURN @Area
END
// We will execute the function with the SELECT statement as:
SELECT [dbo].Circle(5) AS Area
Code Example |
---|
Sql :: how to upper case in sql |
Sql :: mysql show create table |
Sql :: to_char oracle |
Sql :: NVL() Functions |
Sql :: sql get character at index |
Sql :: oracle change tablespace size |
Sql :: mysqldump database |
Sql :: postgresql if else endif |
Sql :: to_date postgresql |
Sql :: download sql server for mac |
Sql :: mysql time |
Sql :: SQLSTATE[01000]: Warning: 1265 Data truncated for column |
Sql :: oracle parameter |
Sql :: not regexp_like in oracle |
Sql :: postgressum when |
Sql :: stuff sql server |
Sql :: t sql dynamic top n query |
Sql :: login failed for login due to trigger execution |
Sql :: mysql changer nom table |
Sql :: ms sql print more than 1 variable |
Sql :: temp tables in sql server |
Sql :: Grant privileges of databse to user |
Sql :: influxdb delete measurement based on date |
Sql :: postgres having |
Sql :: sql server order by nulls last |
Sql :: finish transaction sql |
Sql :: list foreign key oracle |
Sql :: mysql unique constraint |
Sql :: copy table in sql |
Sql :: divide by zero error in sql |