Goal: to create a series of .NET code (CASE)statements from data derived from an Excel spreadsheet, queried via SSMS.
I have a spreadsheet(mysheet.xlsx) which contains 5 columns of data(990 rows)
'111222' 'A COMPANY NAME' 'Col 1: 20' 'Col 2: 15' 'Col 3: 10'
I am able to query the data successfully using:
SELECT TOP 5 *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=Z:\mysheet.xlsx', [Sheet1$])
What I wish to do is, take that queried data, and perform manipulation on it, such that I end up with multiple .NET CASE statements: possibly stuffing the results in a table, in a single row per result.
e.g. using the above row data from Excel, I would like to end up with:
Case 111222 MsgBox("company is:" A COMPANY NAME + Environment.NewLine + Col 1: 20 Col 2: 15 Col 3: 10)
Example of my desired output: