0
SQL, how to write query when column name is a sql-reserved word?
Important : one of the column name is "replace", and it cannot be change. table name = stock_replacement ; column name : [ item_id varchar(4) , replace varchar(1) , replace_from varchar(20), replace_to varchar(20) ]; i need to insert record into table, i tried to put single quote but it is not working. here is my query: insert into stock_replacement ( 'item_id', 'replace ', 'replace_from ', 'replace_to' ) values ( 'q001', 'Y', 'storeroom', 'workshop' ) ; Appreciate, ur TQ.
2 Respuestas
+ 1
thanks, it works. I used `backticks`, tested in php also.
insert into stock_replacement ( item_id, `replace` , replace_from , replace_to)
values ( 'q001', 'Y', 'storeroom', 'workshop' ) ;
[column], "column" cannot be used for insert statement. it success only for select statement