My source is a CSV file which has column names and its related data in rows. How to do manual mapping rows to columns in SQL. Below is the file structure.
CSV file
| EmpNo | ColumnNames | ColumnValues |
| ------------ | ------------ | ------------ |
| 1 | EmpName | 'John' |
| 1 | EmpDOB | '08/30/1985' |
| 1 | EmpDesignation | 'DBA' |
Table : EmployeeDetails
EmpNo | EmpName | EmpDOB | EmpDesignation |
---|---|---|---|
1 | John | 08/30/1985 | DBA |
1条答案
按热度按时间yqkkidmi1#
You can use openrowset to get data from csv file. Here an example that could help you.
you have to improve columns declared in insert into table and select to matching csv columns with table columns.