You can use the name of a column as a condition in SQL Server

0

I am receiving some parameters that leave me the following query:

I need to do a UPDATE in the column MONTO_ENE_18, is it possible that in my query the name of the column can be added so that I can do the UPDATE ?

    
asked by ARR 19.09.2018 в 18:39
source

2 answers

2

Could you give more information about how you are trying to ask?

If what you want is to update that value that you have indicated would be something like

UPDATE nombretabla  SET MONTO_ENE_18 = 40000 WHERE MONTO_ENE_18 = 30382

You could also use an AND to refine the search.

    
answered by 19.09.2018 / 18:48
source
1

To update a record you must use UPDATE , then the table you want, then use SET to specify which fields you want to update, and at the end < strong> WHERE to apply the condition (which filters must be met). Ex:

UPDATE [Tabla1]
SET columna1 = 'valor', columna2 = 'valor2'
WHERE columna1 = 'condicion' and columna4 = 'condicion'

I hope I have helped you in your question, greetings.

    
answered by 19.09.2018 в 18:47