I need to concatenate two columns into one, on the same table. But I need to do this for records that were added within a specific time period. I am thinking of doing something like:
BEGIN TRAN
UPDATE dbo.TableName SET NewColumn = CONCAT(ISNULL(column1, ''), ' ', ISNULL(column2, ''))
COMMIT
I am running the query on MSSQL. I am not sure how to add the date constraint
CodePudding user response:
You will need a WHERE clause with the BETWEEN keyword, like
WHERE column_name BETWEEN value1 AND value2;
Now, instead of column_name you will need to use your date column and instead of value1 and value2, respectively, you will need to use your date boundaries.
