111 lines
4.6 KiB
Transact-SQL
111 lines
4.6 KiB
Transact-SQL
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_TestObjectTemplatesInsert]') AND type in (N'P', N'PC'))
|
||
DROP PROCEDURE [dbo].[sp_TestObjectTemplatesInsert]
|
||
GO
|
||
SET ANSI_NULLS ON
|
||
GO
|
||
SET QUOTED_IDENTIFIER ON
|
||
GO
|
||
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_TestObjectTemplatesInsert]') AND type in (N'P', N'PC'))
|
||
BEGIN
|
||
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[sp_TestObjectTemplatesInsert] AS'
|
||
END
|
||
GO
|
||
ALTER PROCEDURE [dbo].[sp_TestObjectTemplatesInsert]
|
||
@TemplateName nvarchar(255) = null
|
||
,@Icon nvarchar(50)
|
||
,@Description nvarchar(50)
|
||
,@LocalOnly bit
|
||
,@Version int
|
||
,@LastModifiedBy nvarchar(50)
|
||
,@CRC32 int
|
||
,@ISOTestObject nvarchar(255)
|
||
,@TestObjectType nvarchar(255)
|
||
,@LastModified datetime
|
||
,@ParentTemplate nvarchar(50)
|
||
,@SysBuilt bit
|
||
,@OrigTemplateName nvarchar(255)
|
||
,@Embedded bit
|
||
,@new_id int output
|
||
,@errorNumber int output
|
||
,@errorMessage nvarchar(250) output
|
||
|
||
AS
|
||
BEGIN
|
||
set @errorNumber = 0; set @errorMessage = space(0);
|
||
|
||
if(@TemplateName is null)
|
||
begin
|
||
RAISERROR(15600,-1,-1, 'spTestObjectTemplatesInsert') /* Error 1560 - An invalid parameter or option was specified for procedure*/
|
||
end
|
||
else
|
||
begin
|
||
SET NOCOUNT ON;
|
||
INSERT INTO [dbo].[TestObjectTemplates]
|
||
([TemplateName]
|
||
,[Icon]
|
||
,[Description]
|
||
,[LocalOnly]
|
||
,[Version]
|
||
,[LastModifiedBy]
|
||
,[CRC32]
|
||
,[ISOTestObject]
|
||
,[TestObjectType]
|
||
,[ISOFlag]
|
||
,[LastModified]
|
||
,[ParentTemplate]
|
||
,[SysBuilt]
|
||
,[OrigTemplateName]
|
||
,[Embedded])
|
||
VALUES
|
||
(@TemplateName
|
||
,@Icon
|
||
,@Description
|
||
,@LocalOnly
|
||
,@Version
|
||
,@LastModifiedBy
|
||
,@CRC32
|
||
,@ISOTestObject
|
||
,@TestObjectType
|
||
,case when charindex('NONISO', @TestObjectType, 0) = 1 then 0 else 1 end
|
||
,@LastModified
|
||
,@ParentTemplate
|
||
,@SysBuilt
|
||
,@OrigTemplateName
|
||
,@Embedded)
|
||
set @new_id = scope_identity();
|
||
|
||
end
|
||
END
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
GO
|