62 lines
2.0 KiB
Transact-SQL
62 lines
2.0 KiB
Transact-SQL
|
|
|
|
set xact_abort on
|
|
go
|
|
|
|
begin transaction
|
|
go
|
|
|
|
alter table TabTranPosizEventi drop
|
|
constraint DF_TabTranPosizEventi_toAs400 ,
|
|
constraint FK_TabTranPosizEventi_AnagPosizioni ,
|
|
constraint FK_TabTranPosizEventi_AnagTipoEvento
|
|
go
|
|
|
|
exec sp_rename 'PK_TabTranPosizEventi', 'tmp__PK_TabTranPosizEventi', 'OBJECT'
|
|
go
|
|
|
|
exec sp_rename 'TabTranPosizEventi', 'tmp__TabTranPosizEventi_0', 'OBJECT'
|
|
go
|
|
|
|
create table TabTranPosizEventi(
|
|
CodEvento nvarchar(10) not null,
|
|
IdxPosizione int not null,
|
|
IdxPosizioneTo int,
|
|
IdxBloccoTo int,
|
|
toAs400 bit constraint DF_TabTranPosizEventi_toAs400 default (1),
|
|
|
|
constraint PK_TabTranPosizEventi_1 primary key(CodEvento,IdxPosizione)
|
|
)
|
|
go
|
|
|
|
alter table TabTranPosizEventi add
|
|
constraint FK_TabTranPosizEventi_AnagTipoEvento foreign key(CodEvento) references AnagTipoEvento(CodEvento) on update cascade,
|
|
constraint FK_TabTranPosizEventi_AnagPosizioni foreign key(IdxPosizione) references AnagPosizioni(IdxPosizione) on update cascade
|
|
go
|
|
|
|
exec sp_addextendedproperty 'MS_Description', 'NON MODIFICARE: nel codice si usano questi campi x chiamate...', 'SCHEMA', 'dbo', 'TABLE', 'TabTranPosizEventi', 'COLUMN', 'CodEvento'
|
|
go
|
|
|
|
exec sp_addextendedproperty 'MS_Description', 'posizione (stato) logica di partenza', 'SCHEMA', 'dbo', 'TABLE', 'TabTranPosizEventi', 'COLUMN', 'IdxPosizione'
|
|
go
|
|
|
|
exec sp_addextendedproperty 'MS_Description', 'posizione (stato) logica di arrivo', 'SCHEMA', 'dbo', 'TABLE', 'TabTranPosizEventi', 'COLUMN', 'IdxPosizioneTo'
|
|
go
|
|
|
|
exec sp_addextendedproperty 'MS_Description', 'blocco di destinazione', 'SCHEMA', 'dbo', 'TABLE', 'TabTranPosizEventi', 'COLUMN', 'IdxBloccoTo'
|
|
go
|
|
|
|
insert into TabTranPosizEventi(CodEvento,IdxPosizione,IdxPosizioneTo,toAs400) select CodEvento,IdxPosizione,IdxPosizioneTo,toAs400 from tmp__TabTranPosizEventi_0
|
|
go
|
|
|
|
drop table tmp__TabTranPosizEventi_0
|
|
go
|
|
|
|
commit
|
|
go
|
|
|
|
|
|
-- registro versione...
|
|
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(436, GETDATE())
|
|
GO
|