Answer the question
In order to leave comments, you need to log in
What does this SQL script do?
Good afternoon!
Can you please tell me what this script does?
update [dbo].[dvsys_instances]
set ArchiveState = 2
Where InstanceID in
(
SELECT ID
FROM(
Select
Inst. InstanceID [ID]
, case
when [Inst]. '
when [Inst].CardTypeID = '816AE98F-0E9C-4734-B368-642A34948527' then 'SZ'
when [Inst].CardTypeID = '094DEF0A-2CA1-41D8-81B6-70F586FDDE56' then 'VD'
end [Type]
, case
when [Inst].CardTypeID = '2E729D50-6B61-4186-9D14-44E109FD920B' then MainID.[State]
when [Inst].CardTypeID = '
when [Inst].CardTypeID = '094DEF0A-2CA1-41D8-81B6-70F586FDDE56' then MainVD.[State]
end [State]
From [dbo].[dvsys_instances] [Inst]
left join [dbo].[dvsys_instances_date] [IDate ]
on Inst.InstanceID = IDate.InstanceID
left join [dbo].[dvtable_{4C07CA25-41D6-438A-B73E-47FE7650C7BD}] MainID
on Inst.InstanceID = MainID.InstanceID
left join [dbo].[dvtable_{B5D96F96-ACA2 -4184-9702-2D89B1B3936A}] MainSZ
on Inst.InstanceID = MainSZ.InstanceID
left join [dbo].[dvtable_{C06228B9-99F8-4B41-950B-8FACDC00A2B7}] MainVD
on Inst.InstanceID = MainVD.InstanceID
Where [Inst
] GETDATE() - 724)
)T1
WHERE (T1.[Type] = 'ID' and T1.[State] in (5,9))
or(T1.[Type] = 'SZ' and T1.[State] in (4,6,9))
or(T1.[Type] = 'VD' and T1.[State] in (5,6)
)
EXEC [dbo].[dvsys_archive_cards]
There is a DocsVision database and this script should archive various types of documents into archive tables, but something doesn't work
Answer the question
In order to leave comments, you need to log in
The update statement only sets the ArchiveState field in the dvsys_instances table to 2 for the selected records. The entire text of the request is actually a filter for selecting records.
The last line calls the dvsys_archive_cards stored procedure.
I assume that this procedure should archive records that have ArchiveState=2.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question