CREATE TABLE [dbo].[acc_currencies_rates]
(
[cr_base_code] [dbo].[ais_code_short] NOT NULL,
[cr_traded_code] [dbo].[ais_code_short] NOT NULL,
[cr_date] [date] NOT NULL,
[cr_rowver] [timestamp] NOT NULL,
[cr_rate] [dbo].[ais_decimal4] NOT NULL,
[cr_is_fixed] [bit] NOT NULL CONSTRAINT [DF__acc_currencies_rates__cr_is_fixed] DEFAULT ((0))
) ON [PRIMARY]


GO
ALTER TABLE [dbo].[acc_currencies_rates] ADD CONSTRAINT [PK_acc_currencies_rates] PRIMARY KEY CLUSTERED  ([cr_base_code], [cr_traded_code], [cr_date]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_currencies_rates] ADD CONSTRAINT [FK_acc_currencies_rates_acc_currencies_base] FOREIGN KEY ([cr_base_code]) REFERENCES [dbo].[acc_currencies] ([cur_currency_code])
GO
ALTER TABLE [dbo].[acc_currencies_rates] ADD CONSTRAINT [FK_acc_currencies_rates_acc_currencies_traded] FOREIGN KEY ([cr_traded_code]) REFERENCES [dbo].[acc_currencies] ([cur_currency_code])
GO
