Skip to content
Advertisement

SQL replace and insert Into

I have this table “NamesTable” in SQL Server.

I want to insert and replace in a second column the corresponding name like this

This is my query:

The query runs and replace the selected words, but do not insert into my existing table. What I am doing wrong?

Advertisement

Answer

No idea what is the objective of your INSERT query. But you don’t need that.

You need an UPDATE query. SELECT only retrieve from the table, it does not modify or make changes to the table.

Change your SELECT query into an UPDATE query



User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement