I'm getting an error with what should be a simple query to insert data. I've done searching, but for the life of me, I cant figure out whats happening. Here's my SQL:
IF OBJECT_ID('settings') IS NOT NULL
DROP TABLE [settings]
CREATE TABLE [settings] (
[id] [bigint] IDENTITY(1,1) NOT NULL PRIMARY KEY,
[tenant_id] [bigint] NOT NULL,
[name] [varchar](32) NOT NULL,
[value] [varchar](255) NOT NULL
)
INSERT INTO settings
(name, value, tenant_id)
VALUES
('from_email' , '', 1),
('dash_rss', '', 1),
('theme', '', 1),
('version', '0.84', 1),
('iphone_theme', '', 1),
('enable_sandbox_number', 1, 1),
('twilio_endpoint', 'https://api.twilio.com/2008-08-01', 1);
And the error I get is: Conversion failed when converting the varchar value '0.84' to data type int.
Why is it trying to convert this to int when the column is varchar?
I wonder if SQL Server is trying to outsmart you here. I noticed that your 'enable_sandbox_number' row includes an integer for the second parameter. Maybe SQL Server is converting to int because of that. Can you change 1
to '1'
in that row?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With