Folks I'm wondering can you help me here. I have inherited a system that populates a table from Excel using the OPENROWSET command. The table in question is called: tbl_raw_data and then the loaded data is moved on elsewhere...
The excel speasheet can and does change column names and number of rows over time.
The code is something like this:
SET @varSQL = 'SELECT * INTO TBL_RAW_DATA FROM OPENROWSET('''+@driver+''',' + @varConnectionString + ', ''SELECT * FROM ' + @varSheetName + ''')'
EXEC (@varSQL)
I'm new to openrowset command and am wondering is there a "nice" way of altering the command above to parse out carriage returns or line-feed characters ( char(13) & char(10) respectively) as their presence messing things up later on. Lets assume they cannot be removed from the Excel before load.
I'm open to suggestion here but ideally looking for something quick & easy. I know I can probably parse thru the table after population and remove the offending characters & re-write but that could be time consuming....hence looking for nice alternatives
Thanks in advance for any suggestions...
J.