1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
ALTER PROCEDURE IS_APP.spDynamicFormAttachFieldsToBrothersGroup
(
@GroupId int
)
AS
DECLARE
@FK_DynamicForm_FieldType int,
@FK_DynamicForm_FieldControlType int,
@Title nvarchar(50),
@Length int,
@minValue nvarchar(50),
@maxValue nvarchar(50),
@Required bit,
@IconURL nvarchar(127),
@MessageMissing nvarchar(127),
@MessageWrongType nvarchar(127),
@MessageUnderLowerBound nvarchar(127),
@MessageOverUpperBound nvarchar(127),
@SortIndex int
-- Récupération des champs du groupe courant
SELECT
@FK_DynamicForm_FieldType = FLD.FK_DynamicForm_FieldType,
@FK_DynamicForm_FieldControlType = FLD.FK_DynamicForm_FieldControlType,
@Title = FLD.Title,
@Length = FLD.Length,
@minValue = FLD.minValue,
@maxValue = FLD.maxValue,
@Required = FLD.Required,
@IconURL = FLD.IconURL,
@MessageMissing = FLD.MessageMissing,
@MessageWrongType = FLD.MessageWrongType,
@MessageUnderLowerBound = FLD.MessageUnderLowerBound,
@MessageOverUpperBound = FLD.MessageOverUpperBound,
@SortIndex = FLD.SortIndex
FROM
IS_APP.DynamicForm_Field as FLD
WHERE
FLD.FK_DynamicForm_Group = @GroupId
ORDER BY
FLD.SortIndex;
with FieldsToDuplicate as (
SELECT
GRPS.FK_DynamicForm_Group as FK_DynamicForm_Group,
FLD.FK_DynamicForm_FieldType as FK_DynamicForm_FieldType,
FLD.FK_DynamicForm_FieldControlType as FK_DynamicForm_FieldControlType,
FLD.Title as Title,
FLD.Length as Length,
FLD.minValue as minValue,
FLD.maxValue as maxValue,
FLD.Required as Required,
FLD.IconURL as IconURL,
FLD.MessageMissing as MessageMissing,
FLD.MessageWrongType as MessageWrongType,
FLD.MessageUnderLowerBound as MessageUnderLowerBound,
FLD.MessageOverUpperBound as MessageOverUpperBound,
FLD.SortIndex as SortIndex
FROM
IS_APP.DynamicForm_Field as FLD, IS_APP.fnDynamicForm_GetBrotherGroups(@GroupId) as GRPS
WHERE
FLD.FK_DynamicForm_Group = @GroupId
) INSERT INTO IS_APP.DynamicForm_Field (
FK_DynamicForm_Group,
FK_DynamicForm_FieldType,
FK_DynamicForm_FieldControlType,
Title,
Length,
minValue,
maxValue,
Required,
IconURL,
MessageMissing,
MessageWrongType,
MessageUnderLowerBound,
MessageOverUpperBound,
SortIndex
)
SELECT
F.FK_DynamicForm_Group,
F.FK_DynamicForm_FieldType,
F.FK_DynamicForm_FieldControlType,
F.Title,
F.Length,
F.minValue,
F.maxValue,
F.Required,
F.IconURL,
F.MessageMissing,
F.MessageWrongType,
F.MessageUnderLowerBound,
F.MessageOverUpperBound,
F.SortIndex
FROM
FieldsToDuplicate as F
ORDER BY
F.SortIndex
RETURN |
Partager