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.
73 lines
3.7 KiB
73 lines
3.7 KiB
USE [Vertragsverwaltung_20160404]
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_update_spalten] Script Date: 02.12.2016 09:08:53 ******/
|
|
DROP PROCEDURE [dbo].[sp_update_spalten]
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_update_spalten] Script Date: 02.12.2016 09:08:55 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE PROCEDURE [dbo].[sp_update_spalten]
|
|
@tablename varchar(255)
|
|
AS
|
|
begin
|
|
declare @len int
|
|
declare @inhalt varchar(30)
|
|
declare @col varchar(30)
|
|
declare @readonly int
|
|
declare @dbkey int
|
|
declare @alshacken int
|
|
declare @ierrorcode int
|
|
declare @spaltenkey int
|
|
declare @aktiv int
|
|
declare @tiptext varchar(255)
|
|
declare xcursor cursor for
|
|
SELECT column_name
|
|
from INFORMATION_SCHEMA.Columns
|
|
where table_name = @tablename
|
|
open xcursor
|
|
FETCH NEXT FROM xcursor into @col
|
|
WHILE @@FETCH_STATUS = 0 BEGIN
|
|
execute sp_get_dbkey 'spalten', @dbkey output, @ierrorcode output
|
|
set @spaltenkey=@dbkey
|
|
|
|
set @inhalt=@col
|
|
set @readonly=0
|
|
set @aktiv=1
|
|
set @tiptext=''
|
|
set @len=100
|
|
set @alshacken=0
|
|
if upper(@col)='ERSTELLT_AM' begin
|
|
set @inhalt='Erstellungsdatum'
|
|
set @len=100
|
|
set @readonly=1
|
|
end
|
|
if upper(@col)='MUTIERT_AM' begin
|
|
set @inhalt='Mutationsdatum'
|
|
set @len=100
|
|
set @readonly=1
|
|
end
|
|
if upper(@col)='MUTIERER' begin
|
|
set @inhalt='Mutiert durch'
|
|
set @len=40
|
|
set @readonly=1
|
|
end
|
|
if upper(@col)='AKTIV' begin
|
|
set @inhalt='Aktiv'
|
|
set @len=40
|
|
set @alshacken=0
|
|
end
|
|
|
|
insert into spalten (eintragnr,tabelle,tabellenspalte,spalte,readonly,aktiv,erstellt_am, mutiert_am,mutierer,mandantnr,alsHacken,tiptext, breite, reihenfolge)
|
|
values(@spaltenkey,@tablename,@col,@inhalt,@readonly,@aktiv,getdate(),getdate(),-1,1,@alshacken,@tiptext,@len,0)
|
|
FETCH NEXT FROM xcursor into @col
|
|
end
|
|
close xcursor
|
|
deallocate xcursor
|
|
end
|
|
|
|
|
|
GO
|