CREATE TABLE [dbo].[DOEmployees] (
	[ID_DigitalObject] [bigint] NOT NULL ,
	[ID_Employee] [bigint] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[DOImages] (
	[id] [bigint] NOT NULL ,
	[ID_DigitalObject] [bigint] NOT NULL ,
	[ID_Image] [bigint] NOT NULL ,
	[dateCreated] [datetime] NULL ,
	[Moveable] [bit] NULL ,
	[Root] [bit] NULL ,
	[ImageIndex] [bigint] NULL ,
	[ParentID] [bigint] NULL ,
	[ImageLevel] [bigint] NULL ,
	[Sort] [bigint] NULL ,
	[Name] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[FullName] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[OperatingSystem] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[OperatingSystemVersion] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[DeviceSource] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[CompressionScheme] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[ColorSpace] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[LampTypeID] [int] NULL ,
	[Resolution] [bigint] NULL ,
	[ImageWidth] [bigint] NULL ,
	[ImageLength] [bigint] NULL ,
	[BitPerSample] [bigint] NULL ,
	[MIMEType] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[CheckSumCreationDateTime] [datetime] NULL ,
	[CheckSumValue] [bigint] NULL ,
	[ImageSize] [bigint] NULL ,
	[ScannerManufacturer] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[ScannerModelName] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[ScanningSoftware] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[ScanningSoftwareVersionNo] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[ProfileID] [bigint] NULL ,
	[image] [image] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[DOPreservationInformation] (
	[ID_DigitalObject] [bigint] NOT NULL ,
	[ID_Preservation] [bigint] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[DOReformattingGuideLines] (
	[ID_ReformattingMethod] [bigint] NOT NULL ,
	[ID_DigitalObject] [bigint] NOT NULL ,
	[ID_ReformattingGuideLines] [bigint] NOT NULL ,
	[ID_Preservation] [bigint] NOT NULL ,
	[RevisionDateTime] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[DigitalObjects] (
	[ID_DigitalObject] [bigint] NOT NULL ,
	[HandleDO] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[ArchiveDateTime] [datetime] NOT NULL ,
	[ArchiveID] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[ArchivingProfile] [nvarchar] (2000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[CaptureEntityCorporate] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[ResponsabilityEntity] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[CreationDateTime] [datetime] NOT NULL ,
	[DepositDateTime] [datetime] NOT NULL ,
	[ExternalDescriptiveInformation] [nvarchar] (2000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[PreservationOriginalInformation] [nvarchar] (2000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[QuantityOfTerminalObjects] [int] NULL ,
	[DOSize] [int] NULL ,
	[DigitArqID] [bigint] NULL ,
	[TopographicalQuota] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[DigitalizationProfiles] (
	[ProfileID] [bigint] NOT NULL ,
	[ProfileName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[Description] [nvarchar] (300) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Resolution] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[BitDepth] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[Format] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[Compression] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[Rotation] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Brightness] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Contrast] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Sharpness] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Blur] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Employees] (
	[ID_Employee] [bigint] NOT NULL ,
	[CaptureEntityIndividual] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ImageBitDepth] (
	[idBitDepth] [int] NOT NULL ,
	[description] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[value] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ImageCompression] (
	[idCompression] [int] NOT NULL ,
	[description] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[value] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ImageFormat] (
	[idFormat] [int] NOT NULL ,
	[description] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[value] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ImageResolution] (
	[idResolution] [int] NOT NULL ,
	[description] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[value] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[LampType] (
	[LampTypeID] [int] NOT NULL ,
	[Description] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[PreservationInformation] (
	[ID_Preservation] [bigint] NOT NULL ,
	[ArchiveNextDateTime] [datetime] NOT NULL ,
	[ActionHistory] [nvarchar] (2000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[TransformerObject] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Platform] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[TransformerParameters] [nvarchar] (2000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[RenderAnalyseEngines] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[InputFormat] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[RevisionDateTime] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ReformattingGuideLines] (
	[ID_ReformattingGuideLines] [bigint] NOT NULL ,
	[ReformattingGuideLines] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[NormDescription] [nvarchar] (2000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[ID_ReformattingMethod] [bigint] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ReformattingMethod] (
	[ID_ReformattingMethod] [bigint] NOT NULL ,
	[ReformattingMethod] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[MethodDescription] [nvarchar] (2000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[RevisionInterval] (
	[id] [int] NOT NULL ,
	[revisionValue] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[TechnologicalPlatform] (
	[ScannerID] [int] NOT NULL ,
	[ScannerModelName] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[DeviceSource] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[ScannerManufacturer] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[ScanningSoftware] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[ScanningSoftwareVersionNo] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[OperatingSystem] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[OperatingSystemVersion] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE PROCEDURE "GetDocuments"
@PageSize int,
@PageNumber int
AS
DECLARE @Ignore int
DECLARE @LastID int
 
IF @PageNumber > 1
  BEGIN 
        /* For pages > 1 compute how many records to ignore, 
        set ROWCOUNT and SELECT ID into @LastID */
        SET @Ignore = @PageSize * (@PageNumber - 1)
        SET ROWCOUNT @Ignore 
        SELECT @LastID = ID_digitalObject 
               FROM digitalobjects 
               ORDER BY ID_digitalObject DESC
  END
ELSE
  BEGIN
        /* For page #1 just set rowcount to pagesize */ 
        SET ROWCOUNT @PageSize
  END
 
/* Set rowcount to @PageSize and 
SELECT page for output (note the WHERE clause) */
SET ROWCOUNT @PageSize 
      SELECT *
             FROM digitalobjects
             WHERE ID_digitalObject < @LastID
             ORDER BY ID_digitalObject DESC 
SET ROWCOUNT 0


GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_DOEmployees" @pkc1 bigint,@pkc2 bigint
as
delete "DOEmployees"
where "ID_DigitalObject" = @pkc1 and "ID_Employee" = @pkc2
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_DOImages" @pkc1 bigint,@pkc2 bigint,@pkc3 bigint
as
delete "DOImages"
where "id" = @pkc1 and "ID_DigitalObject" = @pkc2 and "ID_Image" = @pkc3
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_DOPreservationInformation" @pkc1 bigint,@pkc2 bigint
as
delete "DOPreservationInformation"
where "ID_DigitalObject" = @pkc1 and "ID_Preservation" = @pkc2
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_DOReformattingGuideLines" @pkc1 bigint,@pkc2 bigint,@pkc3 bigint,@pkc4 bigint
as
delete "DOReformattingGuideLines"
where "ID_ReformattingMethod" = @pkc1 and "ID_DigitalObject" = @pkc2 and "ID_ReformattingGuideLines" = @pkc3 and "ID_Preservation" = @pkc4
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_DigitalObjects" @pkc1 bigint
as
delete "DigitalObjects"
where "ID_DigitalObject" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_DigitalizationProfiles" @pkc1 bigint
as
delete "DigitalizationProfiles"
where "ProfileID" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_Employees" @pkc1 bigint
as
delete "Employees"
where "ID_Employee" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_ImageBitDepth" @pkc1 int
as
delete "ImageBitDepth"
where "idBitDepth" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_ImageCompression" @pkc1 int
as
delete "ImageCompression"
where "idCompression" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_ImageFormat" @pkc1 int
as
delete "ImageFormat"
where "idFormat" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_ImageResolution" @pkc1 int
as
delete "ImageResolution"
where "idResolution" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_LampType" @pkc1 int
as
delete "LampType"
where "LampTypeID" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_PreservationInformation" @pkc1 bigint
as
delete "PreservationInformation"
where "ID_Preservation" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_ReformattingGuideLines" @pkc1 bigint
as
delete "ReformattingGuideLines"
where "ID_ReformattingGuideLines" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_ReformattingMethod" @pkc1 bigint
as
delete "ReformattingMethod"
where "ID_ReformattingMethod" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_RevisionInterval" @pkc1 int
as
delete "RevisionInterval"
where "id" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSdel_TechnologicalPlatform" @pkc1 int
as
delete "TechnologicalPlatform"
where "ScannerID" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_DOEmployees" @c1 bigint,@c2 bigint

AS
BEGIN


insert into "DOEmployees"( 
"ID_DigitalObject", "ID_Employee"
 )

values ( 
@c1, @c2
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_DOImages" @c1 bigint,@c2 bigint,@c3 bigint,@c4 datetime,@c5 bit,@c6 bit,@c7 bigint,@c8 bigint,@c9 bigint,@c10 bigint,@c11 nvarchar(100),@c12 nvarchar(200),@c13 nvarchar(100),@c14 nvarchar(100),@c15 nvarchar(100),@c16 nvarchar(50),@c17 nvarchar(20),@c18 int,@c19 bigint,@c20 bigint,@c21 bigint,@c22 bigint,@c23 nvarchar(50),@c24 datetime,@c25 bigint,@c26 bigint,@c27 nvarchar(100),@c28 nvarchar(100),@c29 nvarchar(100),@c30 nvarchar(50),@c31 bigint,@c32 image

AS
BEGIN


insert into "DOImages"( 
"id", "ID_DigitalObject", "ID_Image", "dateCreated", "Moveable", "Root", "ImageIndex", "ParentID", "ImageLevel", "Sort", "Name", "FullName", "OperatingSystem", "OperatingSystemVersion", "DeviceSource", "CompressionScheme", "ColorSpace", "LampTypeID", "Resolution", "ImageWidth", "ImageLength", "BitPerSample", "MIMEType", "CheckSumCreationDateTime", "CheckSumValue", "ImageSize", "ScannerManufacturer", "ScannerModelName", "ScanningSoftware", "ScanningSoftwareVersionNo", "ProfileID", "image"
 )

values ( 
@c1, @c2, @c3, @c4, @c5, @c6, @c7, @c8, @c9, @c10, @c11, @c12, @c13, @c14, @c15, @c16, @c17, @c18, @c19, @c20, @c21, @c22, @c23, @c24, @c25, @c26, @c27, @c28, @c29, @c30, @c31, @c32
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_DOPreservationInformation" @c1 bigint,@c2 bigint

AS
BEGIN


insert into "DOPreservationInformation"( 
"ID_DigitalObject", "ID_Preservation"
 )

values ( 
@c1, @c2
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_DOReformattingGuideLines" @c1 bigint,@c2 bigint,@c3 bigint,@c4 bigint,@c5 datetime

AS
BEGIN


insert into "DOReformattingGuideLines"( 
"ID_ReformattingMethod", "ID_DigitalObject", "ID_ReformattingGuideLines", "ID_Preservation", "RevisionDateTime"
 )

values ( 
@c1, @c2, @c3, @c4, @c5
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_DigitalObjects" @c1 bigint,@c2 nvarchar(100),@c3 datetime,@c4 nvarchar(100),@c5 nvarchar(2000),@c6 nvarchar(100),@c7 nvarchar(100),@c8 datetime,@c9 datetime,@c10 nvarchar(2000),@c11 nvarchar(2000),@c12 int,@c13 int,@c14 bigint,@c15 nvarchar(100)

AS
BEGIN


insert into "DigitalObjects"( 
"ID_DigitalObject", "HandleDO", "ArchiveDateTime", "ArchiveID", "ArchivingProfile", "CaptureEntityCorporate", "ResponsabilityEntity", "CreationDateTime", "DepositDateTime", "ExternalDescriptiveInformation", "PreservationOriginalInformation", "QuantityOfTerminalObjects", "DOSize", "DigitArqID", "TopographicalQuota"
 )

values ( 
@c1, @c2, @c3, @c4, @c5, @c6, @c7, @c8, @c9, @c10, @c11, @c12, @c13, @c14, @c15
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_DigitalizationProfiles" @c1 bigint,@c2 varchar(50),@c3 nvarchar(300),@c4 varchar(50),@c5 varchar(50),@c6 varchar(50),@c7 varchar(50),@c8 varchar(50),@c9 varchar(50),@c10 varchar(50),@c11 varchar(50),@c12 varchar(50)

AS
BEGIN


insert into "DigitalizationProfiles"( 
"ProfileID", "ProfileName", "Description", "Resolution", "BitDepth", "Format", "Compression", "Rotation", "Brightness", "Contrast", "Sharpness", "Blur"
 )

values ( 
@c1, @c2, @c3, @c4, @c5, @c6, @c7, @c8, @c9, @c10, @c11, @c12
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_Employees" @c1 bigint,@c2 nvarchar(100)

AS
BEGIN


insert into "Employees"( 
"ID_Employee", "CaptureEntityIndividual"
 )

values ( 
@c1, @c2
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_ImageBitDepth" @c1 int,@c2 nvarchar(200),@c3 int

AS
BEGIN


insert into "ImageBitDepth"( 
"idBitDepth", "description", "value"
 )

values ( 
@c1, @c2, @c3
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_ImageCompression" @c1 int,@c2 nvarchar(200),@c3 nvarchar(50)

AS
BEGIN


insert into "ImageCompression"( 
"idCompression", "description", "value"
 )

values ( 
@c1, @c2, @c3
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_ImageFormat" @c1 int,@c2 nvarchar(200),@c3 nvarchar(50)

AS
BEGIN


insert into "ImageFormat"( 
"idFormat", "description", "value"
 )

values ( 
@c1, @c2, @c3
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_ImageResolution" @c1 int,@c2 nvarchar(200),@c3 int

AS
BEGIN


insert into "ImageResolution"( 
"idResolution", "description", "value"
 )

values ( 
@c1, @c2, @c3
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_LampType" @c1 int,@c2 nvarchar(100)

AS
BEGIN


insert into "LampType"( 
"LampTypeID", "Description"
 )

values ( 
@c1, @c2
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_PreservationInformation" @c1 bigint,@c2 datetime,@c3 nvarchar(2000),@c4 nvarchar(100),@c5 nvarchar(100),@c6 nvarchar(2000),@c7 nvarchar(100),@c8 nvarchar(100),@c9 datetime

AS
BEGIN


insert into "PreservationInformation"( 
"ID_Preservation", "ArchiveNextDateTime", "ActionHistory", "TransformerObject", "Platform", "TransformerParameters", "RenderAnalyseEngines", "InputFormat", "RevisionDateTime"
 )

values ( 
@c1, @c2, @c3, @c4, @c5, @c6, @c7, @c8, @c9
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_ReformattingGuideLines" @c1 bigint,@c2 nvarchar(200),@c3 nvarchar(2000),@c4 bigint

AS
BEGIN


insert into "ReformattingGuideLines"( 
"ID_ReformattingGuideLines", "ReformattingGuideLines", "NormDescription", "ID_ReformattingMethod"
 )

values ( 
@c1, @c2, @c3, @c4
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_ReformattingMethod" @c1 bigint,@c2 nvarchar(200),@c3 nvarchar(2000)

AS
BEGIN


insert into "ReformattingMethod"( 
"ID_ReformattingMethod", "ReformattingMethod", "MethodDescription"
 )

values ( 
@c1, @c2, @c3
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_RevisionInterval" @c1 int,@c2 int

AS
BEGIN


insert into "RevisionInterval"( 
"id", "revisionValue"
 )

values ( 
@c1, @c2
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSins_TechnologicalPlatform" @c1 int,@c2 nvarchar(100),@c3 nvarchar(100),@c4 nvarchar(100),@c5 nvarchar(100),@c6 nvarchar(50),@c7 nvarchar(100),@c8 nvarchar(50)

AS
BEGIN


insert into "TechnologicalPlatform"( 
"ScannerID", "ScannerModelName", "DeviceSource", "ScannerManufacturer", "ScanningSoftware", "ScanningSoftwareVersionNo", "OperatingSystem", "OperatingSystemVersion"
 )

values ( 
@c1, @c2, @c3, @c4, @c5, @c6, @c7, @c8
 )


END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_DOEmployees" 
 @c1 bigint,@c2 bigint,@pkc1 bigint,@pkc2 bigint
,@bitmap binary(1)
as
begin
update "DOEmployees" set
"ID_DigitalObject" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "ID_DigitalObject" end
,"ID_Employee" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "ID_Employee" end
where "ID_DigitalObject" = @pkc1 and "ID_Employee" = @pkc2
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_DOImages" 
 @c1 bigint,@c2 bigint,@c3 bigint,@c4 datetime,@c5 bit,@c6 bit,@c7 bigint,@c8 bigint,@c9 bigint,@c10 bigint,@c11 nvarchar(100),@c12 nvarchar(200),@c13 nvarchar(100),@c14 nvarchar(100),@c15 nvarchar(100),@c16 nvarchar(50),@c17 nvarchar(20),@c18 int,@c19 bigint,@c20 bigint,@c21 bigint,@c22 bigint,@c23 nvarchar(50),@c24 datetime,@c25 bigint,@c26 bigint,@c27 nvarchar(100),@c28 nvarchar(100),@c29 nvarchar(100),@c30 nvarchar(50),@c31 bigint,@c32 image,@pkc1 bigint,@pkc2 bigint,@pkc3 bigint
,@bitmap binary(5)
as
if substring(@bitmap,1,1) & 1 = 1 or substring(@bitmap,1,1) & 2 = 2 or substring(@bitmap,1,1) & 4 = 4
begin
update "DOImages" set
"id" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "id" end
,"ID_DigitalObject" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "ID_DigitalObject" end
,"ID_Image" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "ID_Image" end
,"dateCreated" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "dateCreated" end
,"Moveable" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "Moveable" end
,"Root" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "Root" end
,"ImageIndex" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "ImageIndex" end
,"ParentID" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "ParentID" end
,"ImageLevel" = case substring(@bitmap,2,1) & 1 when 1 then @c9 else "ImageLevel" end
,"Sort" = case substring(@bitmap,2,1) & 2 when 2 then @c10 else "Sort" end
,"Name" = case substring(@bitmap,2,1) & 4 when 4 then @c11 else "Name" end
,"FullName" = case substring(@bitmap,2,1) & 8 when 8 then @c12 else "FullName" end
,"OperatingSystem" = case substring(@bitmap,2,1) & 16 when 16 then @c13 else "OperatingSystem" end
,"OperatingSystemVersion" = case substring(@bitmap,2,1) & 32 when 32 then @c14 else "OperatingSystemVersion" end
,"DeviceSource" = case substring(@bitmap,2,1) & 64 when 64 then @c15 else "DeviceSource" end
,"CompressionScheme" = case substring(@bitmap,2,1) & 128 when 128 then @c16 else "CompressionScheme" end
,"ColorSpace" = case substring(@bitmap,3,1) & 1 when 1 then @c17 else "ColorSpace" end
,"LampTypeID" = case substring(@bitmap,3,1) & 2 when 2 then @c18 else "LampTypeID" end
,"Resolution" = case substring(@bitmap,3,1) & 4 when 4 then @c19 else "Resolution" end
,"ImageWidth" = case substring(@bitmap,3,1) & 8 when 8 then @c20 else "ImageWidth" end
,"ImageLength" = case substring(@bitmap,3,1) & 16 when 16 then @c21 else "ImageLength" end
,"BitPerSample" = case substring(@bitmap,3,1) & 32 when 32 then @c22 else "BitPerSample" end
,"MIMEType" = case substring(@bitmap,3,1) & 64 when 64 then @c23 else "MIMEType" end
,"CheckSumCreationDateTime" = case substring(@bitmap,3,1) & 128 when 128 then @c24 else "CheckSumCreationDateTime" end
,"CheckSumValue" = case substring(@bitmap,4,1) & 1 when 1 then @c25 else "CheckSumValue" end
,"ImageSize" = case substring(@bitmap,4,1) & 2 when 2 then @c26 else "ImageSize" end
,"ScannerManufacturer" = case substring(@bitmap,4,1) & 4 when 4 then @c27 else "ScannerManufacturer" end
,"ScannerModelName" = case substring(@bitmap,4,1) & 8 when 8 then @c28 else "ScannerModelName" end
,"ScanningSoftware" = case substring(@bitmap,4,1) & 16 when 16 then @c29 else "ScanningSoftware" end
,"ScanningSoftwareVersionNo" = case substring(@bitmap,4,1) & 32 when 32 then @c30 else "ScanningSoftwareVersionNo" end
,"ProfileID" = case substring(@bitmap,4,1) & 64 when 64 then @c31 else "ProfileID" end
,"image" = case substring(@bitmap,4,1) & 128 when 128 then @c32 else "image" end
where "id" = @pkc1 and "ID_DigitalObject" = @pkc2 and "ID_Image" = @pkc3
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "DOImages" set
"dateCreated" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "dateCreated" end
,"Moveable" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "Moveable" end
,"Root" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "Root" end
,"ImageIndex" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "ImageIndex" end
,"ParentID" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "ParentID" end
,"ImageLevel" = case substring(@bitmap,2,1) & 1 when 1 then @c9 else "ImageLevel" end
,"Sort" = case substring(@bitmap,2,1) & 2 when 2 then @c10 else "Sort" end
,"Name" = case substring(@bitmap,2,1) & 4 when 4 then @c11 else "Name" end
,"FullName" = case substring(@bitmap,2,1) & 8 when 8 then @c12 else "FullName" end
,"OperatingSystem" = case substring(@bitmap,2,1) & 16 when 16 then @c13 else "OperatingSystem" end
,"OperatingSystemVersion" = case substring(@bitmap,2,1) & 32 when 32 then @c14 else "OperatingSystemVersion" end
,"DeviceSource" = case substring(@bitmap,2,1) & 64 when 64 then @c15 else "DeviceSource" end
,"CompressionScheme" = case substring(@bitmap,2,1) & 128 when 128 then @c16 else "CompressionScheme" end
,"ColorSpace" = case substring(@bitmap,3,1) & 1 when 1 then @c17 else "ColorSpace" end
,"LampTypeID" = case substring(@bitmap,3,1) & 2 when 2 then @c18 else "LampTypeID" end
,"Resolution" = case substring(@bitmap,3,1) & 4 when 4 then @c19 else "Resolution" end
,"ImageWidth" = case substring(@bitmap,3,1) & 8 when 8 then @c20 else "ImageWidth" end
,"ImageLength" = case substring(@bitmap,3,1) & 16 when 16 then @c21 else "ImageLength" end
,"BitPerSample" = case substring(@bitmap,3,1) & 32 when 32 then @c22 else "BitPerSample" end
,"MIMEType" = case substring(@bitmap,3,1) & 64 when 64 then @c23 else "MIMEType" end
,"CheckSumCreationDateTime" = case substring(@bitmap,3,1) & 128 when 128 then @c24 else "CheckSumCreationDateTime" end
,"CheckSumValue" = case substring(@bitmap,4,1) & 1 when 1 then @c25 else "CheckSumValue" end
,"ImageSize" = case substring(@bitmap,4,1) & 2 when 2 then @c26 else "ImageSize" end
,"ScannerManufacturer" = case substring(@bitmap,4,1) & 4 when 4 then @c27 else "ScannerManufacturer" end
,"ScannerModelName" = case substring(@bitmap,4,1) & 8 when 8 then @c28 else "ScannerModelName" end
,"ScanningSoftware" = case substring(@bitmap,4,1) & 16 when 16 then @c29 else "ScanningSoftware" end
,"ScanningSoftwareVersionNo" = case substring(@bitmap,4,1) & 32 when 32 then @c30 else "ScanningSoftwareVersionNo" end
,"ProfileID" = case substring(@bitmap,4,1) & 64 when 64 then @c31 else "ProfileID" end
,"image" = case substring(@bitmap,4,1) & 128 when 128 then @c32 else "image" end
where "id" = @pkc1 and "ID_DigitalObject" = @pkc2 and "ID_Image" = @pkc3
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_DOPreservationInformation" 
 @c1 bigint,@c2 bigint,@pkc1 bigint,@pkc2 bigint
,@bitmap binary(1)
as
begin
update "DOPreservationInformation" set
"ID_DigitalObject" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "ID_DigitalObject" end
,"ID_Preservation" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "ID_Preservation" end
where "ID_DigitalObject" = @pkc1 and "ID_Preservation" = @pkc2
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_DOReformattingGuideLines" 
 @c1 bigint,@c2 bigint,@c3 bigint,@c4 bigint,@c5 datetime,@pkc1 bigint,@pkc2 bigint,@pkc3 bigint,@pkc4 bigint
,@bitmap binary(1)
as
if substring(@bitmap,1,1) & 1 = 1 or substring(@bitmap,1,1) & 2 = 2 or substring(@bitmap,1,1) & 4 = 4 or substring(@bitmap,1,1) & 8 = 8
begin
update "DOReformattingGuideLines" set
"ID_ReformattingMethod" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "ID_ReformattingMethod" end
,"ID_DigitalObject" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "ID_DigitalObject" end
,"ID_ReformattingGuideLines" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "ID_ReformattingGuideLines" end
,"ID_Preservation" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "ID_Preservation" end
,"RevisionDateTime" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "RevisionDateTime" end
where "ID_ReformattingMethod" = @pkc1 and "ID_DigitalObject" = @pkc2 and "ID_ReformattingGuideLines" = @pkc3 and "ID_Preservation" = @pkc4
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "DOReformattingGuideLines" set
"RevisionDateTime" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "RevisionDateTime" end
where "ID_ReformattingMethod" = @pkc1 and "ID_DigitalObject" = @pkc2 and "ID_ReformattingGuideLines" = @pkc3 and "ID_Preservation" = @pkc4
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_DigitalObjects" 
 @c1 bigint,@c2 nvarchar(100),@c3 datetime,@c4 nvarchar(100),@c5 nvarchar(2000),@c6 nvarchar(100),@c7 nvarchar(100),@c8 datetime,@c9 datetime,@c10 nvarchar(2000),@c11 nvarchar(2000),@c12 int,@c13 int,@c14 bigint,@c15 nvarchar(100),@pkc1 bigint
,@bitmap binary(2)
as
if substring(@bitmap,1,1) & 1 = 1
begin
update "DigitalObjects" set
"ID_DigitalObject" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "ID_DigitalObject" end
,"HandleDO" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "HandleDO" end
,"ArchiveDateTime" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "ArchiveDateTime" end
,"ArchiveID" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "ArchiveID" end
,"ArchivingProfile" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "ArchivingProfile" end
,"CaptureEntityCorporate" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "CaptureEntityCorporate" end
,"ResponsabilityEntity" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "ResponsabilityEntity" end
,"CreationDateTime" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "CreationDateTime" end
,"DepositDateTime" = case substring(@bitmap,2,1) & 1 when 1 then @c9 else "DepositDateTime" end
,"ExternalDescriptiveInformation" = case substring(@bitmap,2,1) & 2 when 2 then @c10 else "ExternalDescriptiveInformation" end
,"PreservationOriginalInformation" = case substring(@bitmap,2,1) & 4 when 4 then @c11 else "PreservationOriginalInformation" end
,"QuantityOfTerminalObjects" = case substring(@bitmap,2,1) & 8 when 8 then @c12 else "QuantityOfTerminalObjects" end
,"DOSize" = case substring(@bitmap,2,1) & 16 when 16 then @c13 else "DOSize" end
,"DigitArqID" = case substring(@bitmap,2,1) & 32 when 32 then @c14 else "DigitArqID" end
,"TopographicalQuota" = case substring(@bitmap,2,1) & 64 when 64 then @c15 else "TopographicalQuota" end
where "ID_DigitalObject" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "DigitalObjects" set
"HandleDO" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "HandleDO" end
,"ArchiveDateTime" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "ArchiveDateTime" end
,"ArchiveID" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "ArchiveID" end
,"ArchivingProfile" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "ArchivingProfile" end
,"CaptureEntityCorporate" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "CaptureEntityCorporate" end
,"ResponsabilityEntity" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "ResponsabilityEntity" end
,"CreationDateTime" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "CreationDateTime" end
,"DepositDateTime" = case substring(@bitmap,2,1) & 1 when 1 then @c9 else "DepositDateTime" end
,"ExternalDescriptiveInformation" = case substring(@bitmap,2,1) & 2 when 2 then @c10 else "ExternalDescriptiveInformation" end
,"PreservationOriginalInformation" = case substring(@bitmap,2,1) & 4 when 4 then @c11 else "PreservationOriginalInformation" end
,"QuantityOfTerminalObjects" = case substring(@bitmap,2,1) & 8 when 8 then @c12 else "QuantityOfTerminalObjects" end
,"DOSize" = case substring(@bitmap,2,1) & 16 when 16 then @c13 else "DOSize" end
,"DigitArqID" = case substring(@bitmap,2,1) & 32 when 32 then @c14 else "DigitArqID" end
,"TopographicalQuota" = case substring(@bitmap,2,1) & 64 when 64 then @c15 else "TopographicalQuota" end
where "ID_DigitalObject" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_DigitalizationProfiles" 
 @c1 bigint,@c2 varchar(50),@c3 nvarchar(300),@c4 varchar(50),@c5 varchar(50),@c6 varchar(50),@c7 varchar(50),@c8 varchar(50),@c9 varchar(50),@c10 varchar(50),@c11 varchar(50),@c12 varchar(50),@pkc1 bigint
,@bitmap binary(2)
as
if substring(@bitmap,1,1) & 1 = 1
begin
update "DigitalizationProfiles" set
"ProfileID" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "ProfileID" end
,"ProfileName" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "ProfileName" end
,"Description" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "Description" end
,"Resolution" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "Resolution" end
,"BitDepth" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "BitDepth" end
,"Format" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "Format" end
,"Compression" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "Compression" end
,"Rotation" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "Rotation" end
,"Brightness" = case substring(@bitmap,2,1) & 1 when 1 then @c9 else "Brightness" end
,"Contrast" = case substring(@bitmap,2,1) & 2 when 2 then @c10 else "Contrast" end
,"Sharpness" = case substring(@bitmap,2,1) & 4 when 4 then @c11 else "Sharpness" end
,"Blur" = case substring(@bitmap,2,1) & 8 when 8 then @c12 else "Blur" end
where "ProfileID" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "DigitalizationProfiles" set
"ProfileName" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "ProfileName" end
,"Description" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "Description" end
,"Resolution" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "Resolution" end
,"BitDepth" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "BitDepth" end
,"Format" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "Format" end
,"Compression" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "Compression" end
,"Rotation" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "Rotation" end
,"Brightness" = case substring(@bitmap,2,1) & 1 when 1 then @c9 else "Brightness" end
,"Contrast" = case substring(@bitmap,2,1) & 2 when 2 then @c10 else "Contrast" end
,"Sharpness" = case substring(@bitmap,2,1) & 4 when 4 then @c11 else "Sharpness" end
,"Blur" = case substring(@bitmap,2,1) & 8 when 8 then @c12 else "Blur" end
where "ProfileID" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_Employees" 
 @c1 bigint,@c2 nvarchar(100),@pkc1 bigint
,@bitmap binary(1)
as
if substring(@bitmap,1,1) & 1 = 1
begin
update "Employees" set
"ID_Employee" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "ID_Employee" end
,"CaptureEntityIndividual" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "CaptureEntityIndividual" end
where "ID_Employee" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "Employees" set
"CaptureEntityIndividual" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "CaptureEntityIndividual" end
where "ID_Employee" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_ImageBitDepth" 
 @c1 int,@c2 nvarchar(200),@c3 int,@pkc1 int
,@bitmap binary(1)
as
if substring(@bitmap,1,1) & 1 = 1
begin
update "ImageBitDepth" set
"idBitDepth" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "idBitDepth" end
,"description" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "description" end
,"value" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "value" end
where "idBitDepth" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "ImageBitDepth" set
"description" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "description" end
,"value" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "value" end
where "idBitDepth" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_ImageCompression" 
 @c1 int,@c2 nvarchar(200),@c3 nvarchar(50),@pkc1 int
,@bitmap binary(1)
as
if substring(@bitmap,1,1) & 1 = 1
begin
update "ImageCompression" set
"idCompression" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "idCompression" end
,"description" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "description" end
,"value" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "value" end
where "idCompression" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "ImageCompression" set
"description" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "description" end
,"value" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "value" end
where "idCompression" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_ImageFormat" 
 @c1 int,@c2 nvarchar(200),@c3 nvarchar(50),@pkc1 int
,@bitmap binary(1)
as
if substring(@bitmap,1,1) & 1 = 1
begin
update "ImageFormat" set
"idFormat" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "idFormat" end
,"description" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "description" end
,"value" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "value" end
where "idFormat" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "ImageFormat" set
"description" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "description" end
,"value" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "value" end
where "idFormat" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_ImageResolution" 
 @c1 int,@c2 nvarchar(200),@c3 int,@pkc1 int
,@bitmap binary(1)
as
if substring(@bitmap,1,1) & 1 = 1
begin
update "ImageResolution" set
"idResolution" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "idResolution" end
,"description" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "description" end
,"value" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "value" end
where "idResolution" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "ImageResolution" set
"description" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "description" end
,"value" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "value" end
where "idResolution" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_LampType" 
 @c1 int,@c2 nvarchar(100),@pkc1 int
,@bitmap binary(1)
as
if substring(@bitmap,1,1) & 1 = 1
begin
update "LampType" set
"LampTypeID" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "LampTypeID" end
,"Description" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "Description" end
where "LampTypeID" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "LampType" set
"Description" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "Description" end
where "LampTypeID" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_PreservationInformation" 
 @c1 bigint,@c2 datetime,@c3 nvarchar(2000),@c4 nvarchar(100),@c5 nvarchar(100),@c6 nvarchar(2000),@c7 nvarchar(100),@c8 nvarchar(100),@c9 datetime,@pkc1 bigint
,@bitmap binary(2)
as
if substring(@bitmap,1,1) & 1 = 1
begin
update "PreservationInformation" set
"ID_Preservation" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "ID_Preservation" end
,"ArchiveNextDateTime" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "ArchiveNextDateTime" end
,"ActionHistory" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "ActionHistory" end
,"TransformerObject" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "TransformerObject" end
,"Platform" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "Platform" end
,"TransformerParameters" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "TransformerParameters" end
,"RenderAnalyseEngines" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "RenderAnalyseEngines" end
,"InputFormat" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "InputFormat" end
,"RevisionDateTime" = case substring(@bitmap,2,1) & 1 when 1 then @c9 else "RevisionDateTime" end
where "ID_Preservation" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "PreservationInformation" set
"ArchiveNextDateTime" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "ArchiveNextDateTime" end
,"ActionHistory" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "ActionHistory" end
,"TransformerObject" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "TransformerObject" end
,"Platform" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "Platform" end
,"TransformerParameters" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "TransformerParameters" end
,"RenderAnalyseEngines" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "RenderAnalyseEngines" end
,"InputFormat" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "InputFormat" end
,"RevisionDateTime" = case substring(@bitmap,2,1) & 1 when 1 then @c9 else "RevisionDateTime" end
where "ID_Preservation" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_ReformattingGuideLines" 
 @c1 bigint,@c2 nvarchar(200),@c3 nvarchar(2000),@c4 bigint,@pkc1 bigint
,@bitmap binary(1)
as
if substring(@bitmap,1,1) & 1 = 1
begin
update "ReformattingGuideLines" set
"ID_ReformattingGuideLines" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "ID_ReformattingGuideLines" end
,"ReformattingGuideLines" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "ReformattingGuideLines" end
,"NormDescription" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "NormDescription" end
,"ID_ReformattingMethod" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "ID_ReformattingMethod" end
where "ID_ReformattingGuideLines" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "ReformattingGuideLines" set
"ReformattingGuideLines" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "ReformattingGuideLines" end
,"NormDescription" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "NormDescription" end
,"ID_ReformattingMethod" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "ID_ReformattingMethod" end
where "ID_ReformattingGuideLines" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_ReformattingMethod" 
 @c1 bigint,@c2 nvarchar(200),@c3 nvarchar(2000),@pkc1 bigint
,@bitmap binary(1)
as
if substring(@bitmap,1,1) & 1 = 1
begin
update "ReformattingMethod" set
"ID_ReformattingMethod" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "ID_ReformattingMethod" end
,"ReformattingMethod" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "ReformattingMethod" end
,"MethodDescription" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "MethodDescription" end
where "ID_ReformattingMethod" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "ReformattingMethod" set
"ReformattingMethod" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "ReformattingMethod" end
,"MethodDescription" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "MethodDescription" end
where "ID_ReformattingMethod" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_RevisionInterval" 
 @c1 int,@c2 int,@pkc1 int
,@bitmap binary(1)
as
if substring(@bitmap,1,1) & 1 = 1
begin
update "RevisionInterval" set
"id" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "id" end
,"revisionValue" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "revisionValue" end
where "id" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "RevisionInterval" set
"revisionValue" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "revisionValue" end
where "id" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

create procedure "sp_MSupd_TechnologicalPlatform" 
 @c1 int,@c2 nvarchar(100),@c3 nvarchar(100),@c4 nvarchar(100),@c5 nvarchar(100),@c6 nvarchar(50),@c7 nvarchar(100),@c8 nvarchar(50),@pkc1 int
,@bitmap binary(2)
as
if substring(@bitmap,1,1) & 1 = 1
begin
update "TechnologicalPlatform" set
"ScannerID" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "ScannerID" end
,"ScannerModelName" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "ScannerModelName" end
,"DeviceSource" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "DeviceSource" end
,"ScannerManufacturer" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "ScannerManufacturer" end
,"ScanningSoftware" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "ScanningSoftware" end
,"ScanningSoftwareVersionNo" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "ScanningSoftwareVersionNo" end
,"OperatingSystem" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "OperatingSystem" end
,"OperatingSystemVersion" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "OperatingSystemVersion" end
where "ScannerID" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "TechnologicalPlatform" set
"ScannerModelName" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "ScannerModelName" end
,"DeviceSource" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "DeviceSource" end
,"ScannerManufacturer" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "ScannerManufacturer" end
,"ScanningSoftware" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "ScanningSoftware" end
,"ScanningSoftwareVersionNo" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "ScanningSoftwareVersionNo" end
,"OperatingSystem" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "OperatingSystem" end
,"OperatingSystemVersion" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "OperatingSystemVersion" end
where "ScannerID" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

