Exporting and Importing From SQL Scripts

It is possible without SQL script. See the Topic that I link next regarding Data Exports.

Any Report can be modified to become a Data Export using whatever type of column delimiter you choose.


You are immediately going to have an issue with CSV in particular because your decimal separator is a comma, and your column/field delimiter is also a comma. So you will need to craft your Export to quote the columns/fields.

Even though we can do this without SQL, we can still use it if you are more familiar…

###SQL:

SELECT
 mi.[GroupCode] as [GroupCode]
,mi.[Name] as [Product]
,por.[Name] as [Portion]
,pri.[Price] as [Price]

FROM [MenuItems] mi
JOIN [MenuItemPortions] por on por.[MenuItemId]=mi.[Id]
JOIN [MenuItemPrices] pri on pri.[MenuItemPortionId]=por.[Id]

WHERE 1=1
AND isnull(pri.[PriceTag],'') = ''

ORDER BY
 mi.[GroupCode]
,mi.[Name]
,por.[Id] ASC

###Report

[Products:1,1,1, 1]
>>GroupCode|Product|Portion|Price
@@Products

###Data Export

GroupCode,Product,Portion,Price
{REPORT SQL DETAILS:@@Products:F.GroupCode,F.Product,F.Portion,F.Price:
:"{0}","{1}","{2}","{3}"}


When you finally successfully create a CSV Data Export, there is no facility to use the file as an Import to change prices. For that, you will need to create a YAML file instead, which can also be created using Data Exports, and you can then edit the file and use it for import.


Or you can use Excel to dynamically build SQL UPDATE statements which you then execute using SSMS.

2 Likes