Описание скриптов удаления данных

--Удаление единицы измерения

if exists (select * from dbo.sysobjects

where id = OBJECT_ID(N'Del_ed_izm') and OBJECTPROPERTY(id, N'IsProcedure')=1

)

drop procedure Del_ed_izm

go

CREATE procedure Del_ed_izm

@ed_izm varchar(5)

as

DELETE from Goods where ed_izm=@ed_izm

DELETE from Ed_izm where ed_izm=@ed_izm

go

--exec Del_ed_izm '1'

--go

--select * from Ed_izm

--Удаление группы

if exists (select * from dbo.sysobjects

where id = OBJECT_ID(N'Del_group') and OBJECTPROPERTY(id, N'IsProcedure')=1

)

drop procedure Del_group

go

CREATE procedure Del_group

@name_group varchar(25)

as

DELETE from Goods where id_group=(select id_group

from Product_groups

where name_group=@name_group

)

DELETE from Product_groups where name_group=@name_group

go

--exec Del_group '1'

--go

--select * from Product_groups

--select * from Goods

--Удаление товара в ассортимент

if exists (select * from dbo.sysobjects

where id = OBJECT_ID(N'Del_good') and OBJECTPROPERTY(id, N'IsProcedure')=1

)

drop procedure Del_good

go

CREATE procedure Del_good

@name_good varchar(25)

as

DELETE from Goods where name_good=@name_good

go

--exec Del_good '2'

--go

--select * from Goods

--Удаление поставщика

if exists (select * from dbo.sysobjects

where id = OBJECT_ID(N'Del_supplier') and OBJECTPROPERTY(id, N'IsProcedure')=1

)

drop procedure Del_supplier

go

CREATE procedure Del_supplier

@name_supplier varchar(25)

as

DELETE from Deliveries where id_supplier=(

select id_supplier

from Suppliers

where name_supplier=@name_supplier

)

DELETE from Suppliers where name_supplier=@name_supplier

go

--exec Del_supplier '1'

--go

--select * from Suppliers

--Удаление поставки

if exists (select * from dbo.sysobjects

where id = OBJECT_ID(N'Del_delivery') and OBJECTPROPERTY(id, N'IsProcedure')=1

)

drop procedure Del_delivery

go

CREATE procedure Del_delivery

@id_cons_note int

as

exec Del_cons_note @id_cons_note

DELETE from Deliveries where id_cons_note=@id_cons_note

go

--exec Del_delivery 1

--go

--select * from Deliveries

--Удаление накладной

if exists (select * from dbo.sysobjects

where id = OBJECT_ID(N'Del_cons_note') and OBJECTPROPERTY(id, N'IsProcedure')=1

)

drop procedure Del_cons_note

go

CREATE procedure Del_cons_note

@id_cons_note int

as

DELETE from Consignment_note where id_cons_note=@id_cons_note

go

--exec Del_cons_note 1,4,3

--go

--select * from Consignment_note

--select * from Goods

--Удаление клиента



if exists (select * from dbo.sysobjects

where id = OBJECT_ID(N'Del_client') and OBJECTPROPERTY(id, N'IsProcedure')=1

)

drop procedure Del_client

go

CREATE procedure Del_client

@id_client int

as

DELETE from Shipments where id_client=@id_client

DELETE from Clients where id_client=@id_client

go

--exec Del_client 2

--go

--select * from Clients

--Удаление продажи

if exists (select * from dbo.sysobjects

where id = OBJECT_ID(N'Del_shipment') and OBJECTPROPERTY(id, N'IsProcedure')=1

)

drop procedure Del_shipment

go

CREATE procedure Del_shipment

@id_zakaz int

as

exec Del_zakaz @id_zakaz

DELETE from Shipments where id_zakaz=@id_zakaz

go

--exec Del_shipment 1

--go

--select * from Shipments

--Удаление заказа

if exists (select * from dbo.sysobjects

where id = OBJECT_ID(N'Del_zakaz') and OBJECTPROPERTY(id, N'IsProcedure')=1

)

drop procedure Del_zakaz

go

CREATE procedure Del_zakaz

@id_zakaz int

as

DELETE from Zakaz where id_zakaz=@id_zakaz

go

--exec Del_zakaz 2

--go

--select * from Zakaz

--Удаление стоимости товара из истории

if exists (select * from dbo.sysobjects

where id = OBJECT_ID(N'Del_hist_cost') and OBJECTPROPERTY(id, N'IsProcedure')=1

)

drop procedure Del_hist_cost

go

CREATE procedure Del_hist_cost

@id_good int,

@date_time_cost datetime

as

DELETE from History_cost where id_good=@id_good AND date_time_cost=@date_time_cost

go

--exec Del_hist_cost 4, '2012-25-12 23:45:56'

--go

--select * from History_cost



0002716133509640.html
0002765351873335.html
    PR.RU™