You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
3.6 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

USE [Vertragsverwaltung_20160404]
GO
/****** Object: StoredProcedure [dbo].[dt_setpropertybyid_u] Script Date: 02.12.2016 09:08:54 ******/
DROP PROCEDURE [dbo].[dt_setpropertybyid_u]
GO
/****** Object: StoredProcedure [dbo].[dt_setpropertybyid_u] Script Date: 02.12.2016 09:08:54 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
/*
** If the property already exists, reset the value; otherwise add property
** id -- the id in sysobjects of the object
** property -- the name of the property
** uvalue -- the text value of the property
** lvalue -- the binary value of the property (image)
*/
create procedure [dbo].[dt_setpropertybyid_u]
@id int,
@property varchar(64),
@uvalue nvarchar(255),
@lvalue image
as
set nocount on
--
-- If we are writing the name property, find the ansi equivalent.
-- If there is no lossless translation, generate an ansi name.
--
declare @avalue varchar(255)
set @avalue = null
if (@uvalue is not null)
begin
if (convert(nvarchar(255), convert(varchar(255), @uvalue)) = @uvalue)
begin
set @avalue = convert(varchar(255), @uvalue)
end
else
begin
if 'DtgSchemaNAME' = @property
begin
exec dbo.dt_generateansiname @avalue output
end
end
end
if exists (select * from dbo.dtproperties
where objectid=@id and property=@property)
begin
--
-- bump the version count for this row as we update it
--
update dbo.dtproperties set value=@avalue, uvalue=@uvalue, lvalue=@lvalue, version=version+1
where objectid=@id and property=@property
end
else
begin
--
-- version count is auto-set to 0 on initial insert
--
insert dbo.dtproperties (property, objectid, value, uvalue, lvalue)
values (@property, @id, @avalue, @uvalue, @lvalue)
end
GO