------------------------------------------------------------------------------
-- ADVANTAGE 2004.3.2
-- DB OBJECT CHANGES SINCE ADVANTAGE 2004.3.1
-- 06 NOV 2006
------------------------------------------------------------------------------


-- USE Advantage
-- GO



-------------------------------------------------------------------------------
-- TABLE MODS
-------------------------------------------------------------------------------

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AP_Enterprise_Stock]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[AP_Enterprise_Stock]
GO

CREATE TABLE [dbo].[AP_Enterprise_Stock] (
	[AP_Enterprise_Stock_ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Description] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Product_Code] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Pack_Size] [decimal](9, 3) NULL ,
	[Total] [decimal](12, 3) NULL ,
	[Filter] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

 CREATE  CLUSTERED  INDEX [IX_AP_Enterprise_Stock_Search] ON [dbo].[AP_Enterprise_Stock]([Filter], [Product_Code], [Pack_Size]) ON [PRIMARY]
GO

ALTER TABLE [dbo].[AP_Enterprise_Stock] ADD 
	CONSTRAINT [PK_AP_Enterprise_Stock] PRIMARY KEY  NONCLUSTERED 
	(
		[AP_Enterprise_Stock_ID]
	)  ON [PRIMARY] 
GO

setuser
GO

EXEC sp_bindefault N'[dbo].[df_Numeric_One]', N'[AP_Enterprise_Stock].[Pack_Size]'
GO

setuser
GO


-------------------------------------------------------------------------------


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AP_Enterprise_Stock_Filter]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[AP_Enterprise_Stock_Filter]
GO

CREATE TABLE [dbo].[AP_Enterprise_Stock_Filter] (
	[AP_Enterprise_Stock_Filter_ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Description] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Product_Code] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Pack_Size] [decimal](9, 3) NULL ,
	[Total] [decimal](12, 3) NULL ,
	[Filter] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

 CREATE  CLUSTERED  INDEX [IX_AP_Enterprise_Stock_Filter_Search] ON [dbo].[AP_Enterprise_Stock_Filter]([Filter], [Product_Code], [Pack_Size]) ON [PRIMARY]
GO

ALTER TABLE [dbo].[AP_Enterprise_Stock_Filter] ADD 
	CONSTRAINT [PK_AP_Enterprise_Stock_Filter] PRIMARY KEY  NONCLUSTERED 
	(
		[AP_Enterprise_Stock_Filter_ID]
	)  ON [PRIMARY] 
GO

setuser
GO

EXEC sp_bindefault N'[dbo].[df_Numeric_One]', N'[AP_Enterprise_Stock_Filter].[Pack_Size]'
GO

setuser
GO


-------------------------------------------------------------------------------


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AP_Enterprise_Stock_Valuation]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[AP_Enterprise_Stock_Valuation]
GO

CREATE TABLE [dbo].[AP_Enterprise_Stock_Valuation] (
	[AP_Enterprise_Stock_Valuation_ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Description] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Product_Code] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Pack_Size] [decimal](9, 3) NULL ,
	[Total] [money] NULL ,
	[Filter] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

 CREATE  CLUSTERED  INDEX [IX_AP_Enterprise_Stock_Valuation_Search] ON [dbo].[AP_Enterprise_Stock_Valuation]([Filter], [Product_Code], [Pack_Size]) ON [PRIMARY]
GO

ALTER TABLE [dbo].[AP_Enterprise_Stock_Valuation] ADD 
	CONSTRAINT [PK_AP_Enterprise_Stock_Valuation] PRIMARY KEY  NONCLUSTERED 
	(
		[AP_Enterprise_Stock_Valuation_ID]
	)  ON [PRIMARY] 
GO

setuser
GO

EXEC sp_bindefault N'[dbo].[df_Numeric_One]', N'[AP_Enterprise_Stock_Valuation].[Pack_Size]'
GO

setuser
GO


-------------------------------------------------------------------------------


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AP_Enterprise_Slow_Moving_Stock]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[AP_Enterprise_Slow_Moving_Stock]
GO

CREATE TABLE [dbo].[AP_Enterprise_Slow_Moving_Stock] (
	[AP_Enterprise_Slow_Moving_Stock_ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Description] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Product_Code] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Pack_Size] [decimal](9, 3) NULL ,
	[Total] [decimal](12, 3) NULL ,
	[Filter] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

 CREATE  CLUSTERED  INDEX [IX_AP_Enterprise_Slow_Moving_Stock_Search] ON [dbo].[AP_Enterprise_Slow_Moving_Stock]([Filter], [Product_Code], [Pack_Size]) ON [PRIMARY]
GO

ALTER TABLE [dbo].[AP_Enterprise_Slow_Moving_Stock] ADD 
	CONSTRAINT [PK_AP_Enterprise_Slow_Moving_Stock] PRIMARY KEY  NONCLUSTERED 
	(
		[AP_Enterprise_Slow_Moving_Stock_ID]
	)  ON [PRIMARY] 
GO

setuser
GO

EXEC sp_bindefault N'[dbo].[df_Numeric_One]', N'[AP_Enterprise_Slow_Moving_Stock].[Pack_Size]'
GO

setuser
GO


-------------------------------------------------------------------------------

--CREATE UNIQUE INDEX [IX_AS_Day_Ends_Day_End] ON [dbo].[AS_Day_Ends] ([Day_End]  desc )

-------------------------------------------------------------------------------
