According to Wikipedia this syntax looks correct...
INSERT INTO dbo.metadata_type ("name", "publishable")
VALUES
("Content Owner", 0),
("Content Coordinator", 0),
("Writer", 0),
("Content Type", 0),
("State", 1),
("Business Segment", 0),
("Audience", 0),
("Product Life Cycle Stage", 0),
("Category", 0),
("Template", 0)
I'm getting errors. I've tried wrapping the column names in ` but that didn't work either...
Error code 207, SQL state 42S22: Invalid column name 'Content Owner'.
Error code 207, SQL state 42S22: Invalid column name 'Content Coordinator'.
Error code 207, SQL state 42S22: Invalid column name 'Writer'.
Error code 207, SQL state 42S22: Invalid column name 'Content Type'.
Error code 207, SQL state 42S22: Invalid column name 'State'.
In SQL Server, string values are delimited by '
, not"
.
Also, column names should either be enclosed in square brackets, or left as they are (if they don't contain spaces).
Your query should, therefore, look like this:
INSERT INTO dbo.metadata_type (name, publishable) VALUES
('Content Owner', 0),
('Content Coordinator', 0),
('Writer', 0),
('Content Type', 0),
('State', 1),
('Business Segment', 0),
('Audience', 0),
('Product Life Cycle Stage', 0),
('Category', 0),
('Template', 0)
You must use Single quotes instead of double quotes for your values and no quotes at all to specify which column to insert:
INSERT INTO dbo.metadata_type (name, publishable) VALUES
('Content Owner', 0),
('Content Coordinator', 0),
('Writer', 0),
('Content Type', 0),
('State', 1),
('Business Segment', 0),
('Audience', 0),
('Product Life Cycle Stage', 0),
('Category', 0),
('Template', 0)
The 'Error 207' of sql is related to the incorrect column name of the table. I seems that you are trying to retrieve the data about the column name which doesn't exist in the specified table. I suggest you to make sure that your are using correct column name in you query. Also check the table name is correct mentioned in query or not. Try this and let me know if you are still getting same error or not.
if you are trying to insert values to a Varchar using "" try to use simple ''
like:
INSERT INTO dbo.metadata_type (name, publishable) VALUES
('Content Owner', 0),
('Content Coordinator', 0),
('Writer', 0),
('Content Type', 0),
('State', 1),
('Business Segment', 0),
('Audience', 0),
('Product Life Cycle Stage', 0),
('Category', 0),
('Template', 0)
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