Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Databases Programming Interviews:BtrieveClipperData ModelingData StructuresDatabase AdministrationDatabase Administrator (DBA)Database AnalystDatabase DeveloperDB DevelopmentEDI/Data Integration ExpertFirebirdHierarchicalIBM DB2InformixJava DatabaseMariaDBMicrosoft Access DeveloperMongoDBMS SQL ServerMySQL ProgrammingNetworkNoSQLObject RelationalPostgrePostgreSQLProgressRDBMSRelationalSQLSQL AdministratorSQL and PL/SQLSQL Notification ServicesSQL server 2008SSRSStored ProcedureSybaseTeradata
Copyright © 2018. All Rights Reserved
MS SQL Server Interview Question:
How Many Ways to Create Table-Valued Functions?
Submitted by: AdministratorSQL Server supports two syntax of creating table-valued functions:
1. Inline Table-valued Functions - A table-valued function created with a single SELECT statement:
CREATE FUNCTION function_name(
@parameter_1 data_type,
@parameter_2 data_type,
...
@parameter_n data_type
)
RETURNS TABLE
AS
RETURN (select_statement);
2. Multi-statement Table-valued Functions - A table-valued function created with a local temporary table and a statement block:
CREATE FUNCTION function_name(
@parameter_1 data_type,
@parameter_2 data_type,
...
@parameter_n data_type
)
RETURNS @table_variable_name TABLE (
column_definition_list)
AS BEGIN
statement_1;
statement_2;
...
statement_n;
RETURN
END
Submitted by: Administrator
1. Inline Table-valued Functions - A table-valued function created with a single SELECT statement:
CREATE FUNCTION function_name(
@parameter_1 data_type,
@parameter_2 data_type,
...
@parameter_n data_type
)
RETURNS TABLE
AS
RETURN (select_statement);
2. Multi-statement Table-valued Functions - A table-valued function created with a local temporary table and a statement block:
CREATE FUNCTION function_name(
@parameter_1 data_type,
@parameter_2 data_type,
...
@parameter_n data_type
)
RETURNS @table_variable_name TABLE (
column_definition_list)
AS BEGIN
statement_1;
statement_2;
...
statement_n;
RETURN
END
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.