Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql function

Create Function Fn_ToplamaYap(@sayi1 int,@sayi2 int)
Returns int
As
Begin
Declare @toplam int
Set @toplam = @sayi1+ @sayi2
return @toplam
End
Comment

create function syntax sql server

CREATE FUNCTION Fact (@parameter datatype)
RETURNS returndatatype
AS
BEGIN
--sql statements
    RETURN --whatever you want to return but of returndatatype from above
END
Comment

SQL function

//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
Comment

function in sql

CREATE [OR ALTER] FUNCTION <FNAME> (@<PARAMETER NAME1><DATATYPE>[SIZE]
RETURNS <return PARAMETER / ATTRIBUTE /VARIABLE DATATYPE>
AS
BEGIN
<FUNCTION BODY / STATEMENTS>
RETURN <return PARAMETER/ATTRIBUTE/VARIABLE NAME>
END
Comment

PREVIOUS NEXT
Code Example
Sql :: update query in sql server 
Sql :: postgresql set auto increment value 
Sql :: sql server rtrim everything after character 
Sql :: how to create a table in mysql 
Sql :: mysql clear screen 
Sql :: n highest salary in sql 
Sql :: inner join update 
Sql :: select new table sql 
Sql :: sql current timestamp table 
Sql :: sql pagination oracle 
Sql :: postgresql get today 
Sql :: create view in sql 
Sql :: postgresql check privileges on schema 
Sql :: sql drop column 
Sql :: get first monday of month sql 
Sql :: oracle tablespace tables list 
Sql :: postgres create column with default value 
Sql :: sql left characters 
Sql :: What is dialect for Postgres 
Sql :: desc in sql 
Sql :: mysql add column to table 
Sql :: adding constraints to columns SQL 
Sql :: mysql like case sensitive 
Sql :: sql create database 
Sql :: list all tables in postgres 
Sql :: mysql login to a specific database terminal 
Sql :: database timezone 
Sql :: mysql remove records 
Sql :: alternative for LIMIT sql 
Sql :: drop CHECK constraint sql 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =