About Lesson
/*
Functions
1. Scaler Value Function – Returns only one value
2. Inline Table Function – Returns a table
syntax:
create function func_name(@param datatype,…) returns table
as
return (select_statement)
call : select * from inline_table_func_name(value);
Application: It can be used to work with parameterized view
It can be used in join
3. create function – with encryption
create function func_name(@param DT) returns DT with encryption
as
begin
…..
return value
end
4. create function – with schemabinding
create function func_name(@param DT) returns DT with schemabinding
as
begin
…..
return value
end
*/
create function fn_getempbydno(@dno int) returns table
as
return (select * from tblemp where dno=@dno)
select * from dbo.fn_getempbydno(10);
sp_helptext fn_getempbydno