Table Valued Function eklendi

This commit is contained in:
Sedat ÖZTÜRK 2025-12-05 16:48:32 +03:00
parent b9331e66b4
commit cb2e007302
2 changed files with 35 additions and 5 deletions

View file

@ -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`
}

View file

@ -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,
},
],
},