SQL Insert invalid column name non-numeric values only

pengz

I am writing a very basic insert statement. I noticed that the error message "Invalid column name" appears if the VALUE is a character besides a number.

The data type is VARCHAR(50) on all three columns.

Database: MS SQL 2012

Query:

INSERT INTO [test-db].[dbo].[Computer]
           ([id]
           ,[name]
           ,[office])
     VALUES
           (123
           ,john
           ,main)
GO

ERROR:

Msg 207, Level 16, State 1, Line 1
Invalid column name 'john'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'main'.
Roberto Geuke

Change your query to this

INSERT INTO [test-db].[dbo].[Computer]
       ([id]
       ,[name]
       ,[office])
 VALUES
       (123
       ,'john'
       ,'main')
GO

The varchar needs quotes around it to work.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

SQL Server: Invalid Column Name

From Dev

Invalid column name "SENOKO" (SQL Queries)

From Dev

Return only numeric values from column - Postgresql

From Dev

SQL Server 2012 Invalid Column Name?

From Dev

In a table a column datatype is varchar, retrieve only those values of the column which are number / numeric using linq to sql

From Dev

Insert values without mentioning the column name

From Dev

Insert distinct values only for one column

From Dev

MS SQL Invalid Column Name

From Dev

Select SQL Non numeric Values

From Dev

How to check a column contain non numeric values

From Dev

"Invalid column name" when trying to insert data into database using SQL

From Dev

SQLServerException: Invalid column name 'A' when I try to execute SQL insert query

From Dev

SQL Server: Invalid Column Name

From Dev

sql query - Invalid column name

From Dev

Return only numeric values from column - Postgresql

From Dev

sql insert values into specific column

From Dev

SQL Insert query with missing column and Invalid column name

From Dev

SQL server Invalid Column name Invalid object name

From Dev

Insert only modified values and column names into a table

From Dev

Filling non-numeric values in Pandas based on another column

From Dev

Insert distinct values only for one column

From Dev

"Invalid column name" error in SQL

From Dev

"Invalid column name" when trying to insert data into database using SQL

From Dev

SQL: Invalid column name eventhough column is there?

From Dev

Cast substring to int only for numeric values in SQL

From Dev

Cut off all non-numeric values in a column

From Dev

Transform non numeric rows into columns with custom column name

From Dev

SQL: converting a column of numeric and null values to FLOAT

From Dev

Making the column of the DataTable to accept only numeric values

Related Related

  1. 1

    SQL Server: Invalid Column Name

  2. 2

    Invalid column name "SENOKO" (SQL Queries)

  3. 3

    Return only numeric values from column - Postgresql

  4. 4

    SQL Server 2012 Invalid Column Name?

  5. 5

    In a table a column datatype is varchar, retrieve only those values of the column which are number / numeric using linq to sql

  6. 6

    Insert values without mentioning the column name

  7. 7

    Insert distinct values only for one column

  8. 8

    MS SQL Invalid Column Name

  9. 9

    Select SQL Non numeric Values

  10. 10

    How to check a column contain non numeric values

  11. 11

    "Invalid column name" when trying to insert data into database using SQL

  12. 12

    SQLServerException: Invalid column name 'A' when I try to execute SQL insert query

  13. 13

    SQL Server: Invalid Column Name

  14. 14

    sql query - Invalid column name

  15. 15

    Return only numeric values from column - Postgresql

  16. 16

    sql insert values into specific column

  17. 17

    SQL Insert query with missing column and Invalid column name

  18. 18

    SQL server Invalid Column name Invalid object name

  19. 19

    Insert only modified values and column names into a table

  20. 20

    Filling non-numeric values in Pandas based on another column

  21. 21

    Insert distinct values only for one column

  22. 22

    "Invalid column name" error in SQL

  23. 23

    "Invalid column name" when trying to insert data into database using SQL

  24. 24

    SQL: Invalid column name eventhough column is there?

  25. 25

    Cast substring to int only for numeric values in SQL

  26. 26

    Cut off all non-numeric values in a column

  27. 27

    Transform non numeric rows into columns with custom column name

  28. 28

    SQL: converting a column of numeric and null values to FLOAT

  29. 29

    Making the column of the DataTable to accept only numeric values

HotTag

Archive