Chintan Dave

Chintan Dave

  • 1.8k
  • 67
  • 6.9k

How to merge columns of two different tables into one table

Aug 21 2018 8:05 AM
DECLARE @String VaRCHAR(100) = 'Column1|Column2|Column3'
DECLARE @StringColumns VaRCHAR(100) = 'EmpID|EmpName|EmpDate'
Select 1 as Items,value as Columns1
from dbo.Split('|',@String)
Select 1 as Items,value as ColumnsTexts
from dbo.Split('|',@StringColumns)
 
 These are the scripts for two sample tables which I would like to combine in a way given in screenshot.
 
 

Answers (1)