Please push on the right decision, I’ve been fighting for the second day, I tried a lot, one of the most successful was the use of MERGE , but either I wrote crookedly or it didn’t work.
I need to create a temporary table with certain columns and attach one new column one by one (depending on certain tasks)
Below is the code I wrote for the sample. I tried to add a column from the table on the basis of which I created a temporary one. But there is an error
multi-part identifiear "tempTable.column_new"
one)
select col1, col2, ACCOUNT_RC into #account from TABLE1 2)
alter table #account add ACCOUNT_RC_izmenen numeric(18,0) 3)
MERGE #account AS tempTable USING (SELECT ACCOUNT_RC + 1000000, ACCOUNT_RC from TABLE1) as source (ACCOUNT_RC_izmenen, ACCOUNT_RC) ON (tempTable.ACCOUNT_RC = source.ACCOUNT_RC) WHEN MATCHED THEN UPDATE SET tempTable.column_new = source.ACCOUNT_RC_izmenen ;
ACCOUNT_RC_izmenen, but why are you applying to thecolumn_newfield? - teranmergesimilar to a simpleupdate #account set ACCOUNT_RC_izmenen = ACCOUNT_RC_izmenen + 1000000- teran.... UPDATE SET column_new = source...withouttempTable, because it swears. - teran