0
votes

We have been using Kentico Import Toolkit v9.0 to import some of the legacy data from the SQL Server 2008 R2 into the newly created proprietary (Kentico Custom tables).. and at one step, the CMS query is NOT ABLE to handle the SQL Server comparison (with an apostrophe in the string value).. Is there anything in the Tookit that can help overcome that kind of handling? We would not want to alter the source (legacy) data as a text without an apostrophe will likely alter the meaning of the text itself!

A sample query is as below:

SELECT NodeID FROM View_CMS_Tree_Joined WHERE ClassDisplayName ='Custom Table Name' and NodeName = 
'Alzheimer's Disease' (as an example)

Your help is much appreciated! The key ask is how and where can we ESCAPE apostrophe in the CMS query, while inside the Kentico Import Tool?

2

2 Answers

1
votes

Try escaping the single quote in the string by repeating it:

SELECT NodeID FROM View_CMS_Tree_Joined WHERE NodeName = 'Alzheimer''s Disease'

Hope this helps;

1
votes

If you're using display names, you need to convert them to code names. Code names don't allow you to use special characters like single and double quotes. Typically underscores and dashes are about it aside from alpha/numeric characters.

If you can modify the WHERE statement make sure to escape your quotes when writing the query.