SQL to Bulk Add Portion Size to a whole Product Group

Little SQL script to bulk create portion sizes to a whole product group.
Wanted for a quick way to add sizes for spirits and wines after bulk createing products.
Makes simpler then can just run down Price List Editor rather than going in to each product one by one :slight_smile:
For those more comfortable with SQL than YAML.

ASS ALWAYS DQL SCRIPTS DIRECTLY IN TO DATABASE ARE USED AT OWN RISK - ALWAYS BACKUP FIRST…

INSERT INTO [MenuItemPortions] (Name,MenuItemId,Multiplier)
SELECT * FROM
(SELECT 'Bottle' AS Name) as [Name],
(SELECT [Id] AS MenuItemId FROM [MenuItems] WHERE [GroupCode] = 'Spirits') AS [MenuItemId],
(SELECT 1 AS Multiplier) as [Multiplier]

This was my script used to add a ‘Bottle’ portion option to all spirits.

2 Likes

Ive never used sql stuff but this could be useful :slight_smile:

I take it i use sql management studio to do this? Could you show a couple of screenshots of the process to this?

1 Like

I used direct in SQL Manager as is a one off setup thing so didnt see the need to encompass in a script but either way would work…

Pretty much you would just need to change ‘Bottle’ to your new portion to be added and ‘Spirits’ to the group you want to include… You could repetitively easily adjust the WHERE to apply to different field…

Never used multiplier but obviously it would just apply 1 to all, you could change the 1 if needed.

Its as easy as starting a new query and pasting that in and making your adjustments :slight_smile:

Did you not see my duplicate menu category script?

That was wrapped in a JScript but similar prinsaple :slight_smile:
You input a from category name and from menu name as well as a to menu name to duplicate the menu category over to a second menu.
Was when I was trying to workout a way to have compound menus.

1 Like