Bulk importing data with SQL script

Tim G. asked on July 4, 2018 08:45

I have a large amount of data from a previous site that I'd like to bulk import into my Kentico 11 build. I'd hoped to be able to do this with a SQL script (simple insert statements) but wasn't sure if this would cause any issues.

The data to be imported is a custom page type so I'm assuming I'd need to create two INSERT statements - one for the table dbo.CustomPageType and another for dbo.CMS_Document and link these via the value in DocumentForeignKeyValue in CMS_Document.

Would this work or are there other linked tables?

Recent Answers


David te Kloese answered on July 4, 2018 09:49 (last edited on July 4, 2018 09:49)

Hi Tim,

Although you'll probably get it to work at some point (you currently forgetting at least one table CMS_Tree for the node info), but it's easy to miss something and lose something or even destroy your complete database.

Some things that you might miss:

  • workflow
  • how to handle duplicate pages
  • replacing invalid URL characters
  • update cache
  • not to mention triggering other (custom) Kentico processes like staging, import export, Continuous Integration or even a custom event handler that might be in place.

Best way is to just use the API to do the insert. It's not even that complicated. Here is an example using a task to fill a custom table getting data from a different DB: devnet.kentico.com/.../using-bulkinsert-to-import-data-in-kentico

Also the API examples (docs.kentico.com/../Pages-Pagecreation) have a ton of examples on how to use the Kentico API.

0 votesVote for this answer Mark as a Correct answer

vasu yerramsetti answered on July 4, 2018 10:21

@Tim

You can follow below approaches for import the data from external to Ketico as a Page Type.

1. Using Kentico API: Page Type content storing in Kentico with the following tables. Reference https://docs.kentico.com/api11/content-management/pages

  1. Coupled Table
  2. CMS_Document
  3. CMS_Tree

2. Kentico Import toolkit.

I hope this will help you.

0 votesVote for this answer Mark as a Correct answer

Tim G. answered on July 5, 2018 17:11

Thanks for all the suggestions - I'll take a look at the API and see if that helps.

To clarify - the previous site for the client is in Kentico 7 (the new site is Kentico 11). The data I want to migrate consists of a custom page type and all the pages created using that custom page type. I'd rather not recreate these manually as there's a lot of work involved.

Any further suggestions on this could be done?

0 votesVote for this answer Mark as a Correct answer

vasu yerramsetti answered on July 5, 2018 17:26

@Tim,

You can also upgrade from Kentico 7 to 11.

Steps:

  1. Upgrade Kentico 7 to 8
  2. Upgrade kentico 8 to 8.1
  3. Upgrade kentico 8.1 to 8.2
  4. Upgrade kentico 8.2 to 9
  5. Upgrade kentico 9 to 10
  6. Upgrade kentico 10 to 11

No need to write any API code for importing the content from Kentico 7 to Kentico 11.

I hope this will help you.

0 votesVote for this answer Mark as a Correct answer

Tim G. answered on July 5, 2018 17:32

@vasu yerramsetti - if I stepped the site through the upgrade process how would I then import the content? The new site is already in development using Kentico 11. Using the tools I haven't seen any way to export a branch of the page tree (and associated page types).

0 votesVote for this answer Mark as a Correct answer

vasu yerramsetti answered on July 5, 2018 19:11

@Tim,

Ok. Please try with Kentico Import Toolkit. Kentico Import Toolkit is an external utility which enables you to import data from external sources into Kentico. As a source of data, you can use:

  1. MS SQL database
  2. XML file
  3. CSV file
  4. XLSX file

Data from these sources can be imported as:

  1. Pages
  2. Page attachments
  3. Objects
  4. Object attachments (metafiles)
  5. Custom table items
  6. On-line form items
  7. Resource strings

Please go through below URLs and you got some idea.

https://docs.kentico.com/k11/external-utilities/kentico-import-toolkit

https://docs.kentico.com/k11/external-utilities/kentico-import-toolkit/importing-data-from-external-sources

I hope this will help you.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.