Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
murrayb3024
Yak Posting Veteran
79 Posts |
Posted - 2013-04-15 : 13:51:51
|
One of our vendors gives up an excel report that is great for reading but not when it comes to importing and using the data.I finally have it importing into a table with all of the data. Here is where I am having a problem. I have a load table. It has about 20 columns in it. This is part of it:Column1 Column2Location: 1 - LocationName100 21102 33202 99Location: 17 - LocationName220 6298 88444 11Location: 19 - LocationName776 66889 88The 3 digit codes on the left are employees and they are associated with the location that they are under and I need to get that on each line. What I would like is for it to look something like this:Col1 Col2 Col3100 21 1102 33 1202 99 1220 6 17298 88 17444 11 17776 66 19889 88 19If only the vendor would just give us a flat file of raw data this would not be an issue, but that is not the case.Thoughts? |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2013-04-15 : 14:40:55
|
>>Thoughts?1. first I would ask if the vendor can provide the data in a format that you specify. They should be able to easily.2. If you're more comfortable in Excel then t-sql then use Excel functions to manipulate the data into a form you can directly import. Often, rather than import, I will create a function that resolves to an INSERT VALUES statement. Copy that down all your rows and just copy the results into a query window.3. if you have to use only t-sql then you'll need to add a sequence column in the excel data so that you'll have a way to associate rows without a location to the location in the last row that a location was specified.Be One with the OptimizerTG |
|
|
murrayb3024
Yak Posting Veteran
79 Posts |
Posted - 2013-04-15 : 15:12:39
|
We are setting up a meeting with the vendor, but from past experience I think they are going to try to bill us a high amount to do this. This vendor is my nemesis. |
|
|
|
|
|