alter table bar add [expire1] [nvarchar](255) NULL, [expire2] [nvarchar](255) NULL, [expire3] [nvarchar](255) NULL, [expire4] [nvarchar](255) NULL, [expire5] [nvarchar](255) NULL, [expire6] [nvarchar](255) NULL go drop view taswyastock go create view taswyastock as SELECT SUM(taswyaDetail.inquantity*units.quantity*compoundcompontents.quantity)-SUM(taswyaDetail.outquantity*units.quantity*compoundcompontents.quantity) AS q, compoundcompontents.itemcode, taswyaDetail.expirecode, taswyaDetail.stockid FROM taswyaDetail INNER JOIN units ON taswyaDetail.unitid=units.unitid INNER JOIN compoundcompontents ON taswyaDetail.itemcode=compoundcompontents.compoundid GROUP BY compoundcompontents.itemcode, compoundcompontents.quantity, taswyaDetail.expirecode, taswyaDetail.stockid; go CREATE TABLE [dbo].[orderSequences]( [orderid] [int] default 0, [sequenceid] [int] default 0, [stockid] [int] default 0, [compoundid] [int] default 0, [unitid] [int] default 0, [inquantity] [float] default 0, [outquantity] [float] default 0, [price] [float] default 0, [discount] [float] default 0, [netprice] [float] default 0, [expirecode] [int] default 0, [unitnetprice] [float] default 0, [done] [bit] default 0 ) alter table orders add [sequenceid] [int] default 0 update orders set [sequenceid]=0