[Skip to main content](#vessel-content)

#   Create a CSV file from MS-SQL server query

##

- **[zaurb](/forum/user/7791-zaurb "View zaurb's Profile")**
- [![zaurb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/7791-zaurb "View zaurb's Profile") Topic Author
- [ Offline](/forum/user/7791-zaurb)

Less More

- Posts: 3
- Thank you received: 0
-
-

14 years 4 months ago [\#53533](#53533) by [zaurb](/forum/user/7791-zaurb "View zaurb's Profile")  *[Create a CSV file from MS-SQL server query](/forum/4-how-to/53533-create-a-csv-file-from-ms-sql-server-query#53533 "Hi!  I need to produce an input CSV file for importing into HikaShop. I've created an export file which is attached to this post. The data is related to food products and has several custom fields, like EAN code, Ingredients, Original Description, etc., various categories and subcategories. The products can be sold either in standard cartons or as single items. For this I have created variant which is called Unit (of measure) with two options Scatole (Boxes) and Pezzi (single items).  The original data is all on a Microsoft SQL Server and I can create a simple SELECT query to produce a table with item numbers, descriptions, prices, categories, etc. However, when I do export from HikaShop product page to see the format of the file to be created, I notice that it's not just a simple table, but some rows are dedicated only to categories and subcategories, while some are specific to variants, etc. So, I'm a bit confused about producing an input CSV file. Can you advise how to produce such table using a SQL query? Or any other way to accomplish this task? Also, if possible, I would like to automate importing proc using a CRON job once I figure out the way to produce an import CSV file for HikaShop.  Many thanks in advance!")* was created by *[zaurb](/forum/user/7791-zaurb "View zaurb's Profile")*

Hi!

I need to produce an input CSV file for importing into HikaShop. I've created an export file which is attached to this post.
The data is related to food products and has several custom fields, like EAN code, Ingredients, Original Description, etc., various categories and subcategories.
The products can be sold either in standard cartons or as single items. For this I have created variant which is called Unit (of measure) with two options Scatole (Boxes) and Pezzi (single items).

The original data is all on a Microsoft SQL Server and I can create a simple SELECT query to produce a table with item numbers, descriptions, prices, categories, etc.
However, when I do export from HikaShop product page to see the format of the file to be created, I notice that it's not just a simple table, but some rows are dedicated only to categories and subcategories, while some are specific to variants, etc.
So, I'm a bit confused about producing an input CSV file.
Can you advise how to produce such table using a SQL query? Or any other way to accomplish this task? Also, if possible, I would like to automate importing proc using a CRON job once I figure out the way to produce an import CSV file for HikaShop.

Many thanks in advance!

*This attachment is hidden for guests.
Please log in or register to see it.*

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzUzNTMzLWNyZWF0ZS1hLWNzdi1maWxlLWZyb20tbXMtc3FsLXNlcnZlci1xdWVyeT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86315
- Thank you received: 14276
-
-

14 years 4 months ago [\#53607](#53607) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Create a CSV file from MS-SQL server query](/forum/4-how-to/53533-create-a-csv-file-from-ms-sql-server-query#53607 "Hi!  I need to produce an input CSV file for importing into HikaShop. I've created an export file which is attached to this post. The data is related to food products and has several custom fields, like EAN code, Ingredients, Original Description, etc., various categories and subcategories. The products can be sold either in standard cartons or as single items. For this I have created variant which is called Unit (of measure) with two options Scatole (Boxes) and Pezzi (single items).  The original data is all on a Microsoft SQL Server and I can create a simple SELECT query to produce a table with item numbers, descriptions, prices, categories, etc. However, when I do export from HikaShop product page to see the format of the file to be created, I notice that it's not just a simple table, but some rows are dedicated only to categories and subcategories, while some are specific to variants, etc. So, I'm a bit confused about producing an input CSV file. Can you advise how to produce such table using a SQL query? Or any other way to accomplish this task? Also, if possible, I would like to automate importing proc using a CRON job once I figure out the way to produce an import CSV file for HikaShop.  Many thanks in advance!")*

Hi,

The lines regarding the categories are not necessary. They can be used to import a category structure. If you already have your categories, or if you don't have ambiguous category names (several different categories with the same name), you should not need them.

Regarding variants/characteristics, when you have characteristics attached to a product in HikaShop, each combination of characteristic values corresponding to a variant. Each variant of the product is stored in the hikashop_product table. That allows you to specify different prices,quantities, information, etc for different variants.
Without the variants generated the characteristics won't display properly on the product page.

I can't tell you how to do your query. It depends on your MSSQL database structure which I don't know.

What I can say though is that it sure is possible to import it automatically. In the commercial editions of Hikashop, there is a data feed plugin which uses the cron system available to automatically import CSV files in HikaShop. You could either use it if the format is the correct one, or modify it to adapt the data of your CSV to HikaShop (so that could be a solution in order to inject the variants in the CSV, if you can't generate these lines with your MSSQL CSV export).

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzUzNTMzLWNyZWF0ZS1hLWNzdi1maWxlLWZyb20tbXMtc3FsLXNlcnZlci1xdWVyeT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.094 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
