Table Valued Function eklendi
This commit is contained in:
parent
b9331e66b4
commit
cb2e007302
2 changed files with 35 additions and 5 deletions
|
|
@ -212,8 +212,8 @@ WHERE
|
|||
t1.IsActive = 1;
|
||||
GO`,
|
||||
|
||||
'create-function': `-- Create Scalar Function
|
||||
CREATE FUNCTION [dbo].[FunctionName]
|
||||
'create-scalar-function': `-- Create Scalar Function
|
||||
CREATE FUNCTION [dbo].[ScalarFunctionName]
|
||||
(
|
||||
@Parameter1 INT,
|
||||
@Parameter2 NVARCHAR(100)
|
||||
|
|
@ -230,6 +230,30 @@ BEGIN
|
|||
|
||||
RETURN @Result;
|
||||
END
|
||||
GO`,
|
||||
|
||||
'create-table-function': `-- Create Table-Valued Function
|
||||
CREATE FUNCTION [dbo].[TableFunctionName]
|
||||
(
|
||||
@Parameter1 INT,
|
||||
@Parameter2 NVARCHAR(100)
|
||||
)
|
||||
RETURNS TABLE
|
||||
AS
|
||||
RETURN
|
||||
(
|
||||
SELECT
|
||||
t.Column1,
|
||||
t.Column2,
|
||||
t.Column3,
|
||||
t.Column4
|
||||
FROM
|
||||
TableName t
|
||||
WHERE
|
||||
t.Id = @Parameter1
|
||||
AND t.Column2 LIKE '%' + @Parameter2 + '%'
|
||||
AND t.IsActive = 1
|
||||
)
|
||||
GO`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -155,10 +155,16 @@ const SqlObjectExplorer = ({
|
|||
data: { templateType: 'create-view' } as any,
|
||||
},
|
||||
{
|
||||
id: 'template-function',
|
||||
label: 'Function',
|
||||
id: 'template-scalar-function',
|
||||
label: 'Scalar Function',
|
||||
type: 'object' as const,
|
||||
data: { templateType: 'create-function' } as any,
|
||||
data: { templateType: 'create-scalar-function' } as any,
|
||||
},
|
||||
{
|
||||
id: 'template-table-function',
|
||||
label: 'Table-Valued Function',
|
||||
type: 'object' as const,
|
||||
data: { templateType: 'create-table-function' } as any,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue