SKU priceshed R1 R5 W1 W5 W10 W25 W50
1099 branch $5 $3 2.99
1089 branch $1 .99 .75 .69
where R1 is the retail price for 1 item, W1 is the wholsale price for 1item
And turn it into
There will always be an R1 and W1 with any combination of the rest.
9999 is the max number on the "to" count.
Right now I am using multiple queries to accomplish this. I would like to create a VB script to do the work. Once this conversion is complete the converted table is in the same format as the production system pricing guide and then we compare the two and make changes. The origin format is to make it easy on the person who has to update pricing on many items relatively often.
Any ideas would be greatly appreciated.
thanks
Microsoft AccessMicrosoft SQL ServerDatabases
Last Comment
AccessYourBiz_Com
8/22/2022 - Mon
Anthony Perkins
>>Zones: Microsoft Access Database, Databases Miscellaneous, MS SQL Server<<
If you are looking for a T-SQL solution, the way you would do this is with the UNION ALL clause, in other words build a series of SQL statements with a UNION ALL in between.
If on the other hand, this question is not using T-SQL than I suggest you request that the MS SQL Server zone be removed.
chenault68
ASKER
You are correct I should have added VB in the place of SQL.
Andrew_Webster
Can you show us a bit more sample data from the first set, maybe even put it into an Excel sheet or something to show us how it's arranged in a table?
Your help has saved me hundreds of hours of internet surfing.
fblack61
AccessYourBiz_Com
You should use the InStr function to parse through the each line of data. Looks like the beginning of each line starts with "SKU". Then also use the Mid() function to step through each part of the string and extract the information you want and put into the table.
I can try to put something together which may help.
AccessYourBiz_Com
What determines the SKU 1099 vs 1089 in your string "SKU priceshed R1 R5 W1 W5 W10 W25 W50"?
The detail of your second line reads:
1099 Branch Wholesale 1 9 $3
I understand the Price of $1 is from W1, but where are you getting the $3 price from? I don't see anything in the string for that. Same question for the "9".
Basically you need to use the Instr() function and/or the Mid() function to parse through your string and add the records. If the length of the string is fixed, then you only need to use the Mid() function since you can determine the fixed starting and ending lengths of the data you want to extract.
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
If you are looking for a T-SQL solution, the way you would do this is with the UNION ALL clause, in other words build a series of SQL statements with a UNION ALL in between.
If on the other hand, this question is not using T-SQL than I suggest you request that the MS SQL Server zone be removed.