DROP TABLE pricing.target_prices;

CREATE TABLE pricing.target_prices (
	stlc        nvarchar(8)     NOT NULL,
	ds          nvarchar(20)    NOT NULL,
	chan        nvarchar(3)     NOT NULL,
	tier        nvarchar(1)     NOT NULL,
	vol         nvarchar(20)    NOT NULL,
	lower_bound int             NOT NULL,
	upper_bound int                 NULL,
	price       numeric(28,6)   NOT NULL,
	math        nvarchar(MAX)       NULL
);

ALTER TABLE pricing.target_prices
ADD CONSTRAINT uq_target_prices_unique_combo
UNIQUE (stlc, ds, chan, tier, vol, lower_bound);

--SELECT COUNT(*) FROM pricing.target_prices

CREATE TABLE pricing.import_target_prices (
	stlc        nvarchar(8)     NOT NULL,
	ds          nvarchar(20)    NOT NULL,
	chan        nvarchar(3)     NOT NULL,
	tier        nvarchar(1)     NOT NULL,
	vol         nvarchar(20)    NOT NULL,
	lower_bound int             NOT NULL,
	upper_bound int                 NULL,
	price       numeric(28,6)   NOT NULL,
	math        nvarchar(MAX)       NULL
);
