The problem
I'm from South America, and when I was trying to install SQL Server in my PC I was required to install the Spanish version (Spain format) and for that, I also had to change the configuration of my computer.
What is wrong with the spanish (from Spain) format?:
Well, they use as indicator of decimals a comma ',' instead of a dot. So 4.5 is 4,5 under this format.
How this affects the project? (in ASP.NET Core):
Most of the devices in my country use the 'regular format' (4.5) and just now I encountered a problem where I can't save into the database a number with this format: 4.5
So, I have some questions:
- How can I check what kind of format the Database is requesting? (Just to be sure this is the problem)
- How can I change the language configuration of my SQL server / or just the format for numbers expected for the database so it starts accepting this format:
4.5
?
Here is the definition of the table I'm having problems with:
CREATE TABLE [dbo].[Device] (
[DeviceID] INT IDENTITY (1, 1) NOT NULL,
[DeviceName] NVARCHAR (MAX) NULL,
[Id] INT NOT NULL,
[InitialAmount] INT DEFAULT ((0)) NOT NULL,
[DeviceStatus] INT DEFAULT ((0)) NOT NULL,
[DeviceDateCreated] DATETIME2 (7) DEFAULT ('0001-01-01T00:00:00.000') NOT NULL,
[StoreID] INT DEFAULT ((0)) NOT NULL,
[MachineOwnerID] INT DEFAULT ((0)) NOT NULL,
[CoinValue] REAL NOT NULL,
[FechaPUnit] DATETIME2 (7) DEFAULT ('0001-01-01T00:00:00.000') NOT NULL,
[PUnit] REAL NOT NULL,
[SellType] NVARCHAR (MAX) NULL,
CONSTRAINT [PK_Device] PRIMARY KEY CLUSTERED ([DeviceID] ASC),
CONSTRAINT [FK_Device_Machine_Id] FOREIGN KEY ([Id]) REFERENCES [dbo].[Machine] ([Id]) ON DELETE CASCADE);
Both are defined as real numbers.
This problem was detected on this question: Input(float) gets converted to integer while saving