Maybe you need something like this:
insert AnotherTable (TableName, FieldName, OperationType, [Date])
select @FinalTable, Cols, 'Added', getutcdate()
from #AddedColumns
union all
select @FinalTable, Cols, 'Deleted', getutcdate()
from #DeletedColumns
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have a table in that table has 1 column(Cols) and it has 2 Records see below
I have another table and it has 4 columns see below
I want to insert first table 2 columns into 2nd table FieldName column
How to do that?
Maybe you need something like this:
insert AnotherTable (TableName, FieldName, OperationType, [Date])
select @FinalTable, Cols, 'Added', getutcdate()
from #AddedColumns
union all
select @FinalTable, Cols, 'Deleted', getutcdate()
from #DeletedColumns
Hi @Madhusudan Reddy Mandala ,
Welcome to the microsoft TSQL Q&A forum!
Could you please validate all the answers so far and provide any update?
If all of them are not working or helpful, please provide more sample data or details about your issue.
Please remember to accept the answers if they helped. Your action would be helpful to other users who encounter the same issue and read this thread.
Thank you for understanding!
Regards
Echo