mirror of
https://github.com/bitwarden/server.git
synced 2024-12-30 18:17:36 +01:00
4bc683c38d
* Allow for tax rates with 3 decimal places * Update input validation * Increase precision of create procedure
45 lines
743 B
Transact-SQL
45 lines
743 B
Transact-SQL
IF OBJECT_ID('[dbo].[TaxRate]') IS NOT NULL
|
|
BEGIN
|
|
ALTER TABLE
|
|
[dbo].[TaxRate]
|
|
ALTER COLUMN
|
|
[Rate] DECIMAL(6,3) NOT NULL;
|
|
END
|
|
|
|
IF OBJECT_ID('[dbo].[TaxRate_Create]') IS NOT NULL
|
|
BEGIN
|
|
DROP PROCEDURE [dbo].[TaxRate_Create]
|
|
END
|
|
GO
|
|
|
|
CREATE PROCEDURE [dbo].[TaxRate_Create]
|
|
@Id VARCHAR(40) OUTPUT,
|
|
@Country VARCHAR(50),
|
|
@State VARCHAR(2),
|
|
@PostalCode VARCHAR(10),
|
|
@Rate DECIMAL(6,3),
|
|
@Active BIT
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON
|
|
|
|
INSERT INTO [dbo].[TaxRate]
|
|
(
|
|
[Id],
|
|
[Country],
|
|
[State],
|
|
[PostalCode],
|
|
[Rate],
|
|
[Active]
|
|
)
|
|
VALUES
|
|
(
|
|
@Id,
|
|
@Country,
|
|
@State,
|
|
@PostalCode,
|
|
@Rate,
|
|
1
|
|
)
|
|
END
|