Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have DB MS SQL server with polish characters.
I’ve got plenty records as a result from query below:
select wo.WORKORDERID, cd.CATEGORYNAME
from workorder wo
left join WorkOrderStates ws on wo.WORKORDERID=ws.WORKORDERID
LEFT JOIN CategoryDefinition cd ON ws.CATEGORYID=cd.CATEGORYID
where (ws.ISOVERDUE=1)
and (cd.CATEGORYNAME COLLATE SQL_Latin1_General_CP1_CI_AS = N'Bezpieczeństwo');
When executing query without N-prefix before ‘Bezpieczeństwo’, I’ve got nothing.
Field "CATEGORYNAME" in DB is nvarchar.
Problem may be with this issue: http://support.microsoft.com/kb/239530.
Now I want to load table CategoryDefinition to qlik sense. Load script looks like below:
[Kategorie CategoryDefinition]:
LOAD
[CATEGORYID] AS [ID kategorii],
[CATEGORYNAME] AS [Kategoria],
SELECT CATEGORYID,
CAST (CATEGORYNAME AS Nvarchar(max)) AS CATEGORYNAME,
FROM "servicedeskit_backup".dbo.CategoryDefinition WHERE categoryname in ('Awarie', 'Bezpieczeństwo','Wnioski', 'Zakupy');
Only 3 categories are imported, without ‘Bezpieczeństwo’ – only in this one is polish character ‘ń’.
It doesn’t matter if I use in script CAST….AS Nvarchar(max) or not.
In main script I have definition SET CollationLocale='pl-PL';
Could someone please give me idea how to modify load script to import all required categories?
Maybe also next question: I if want to load to qlik all values from field like DESCRIPTION, where plenty of polish characters exist, and there is no WHERE clause in load script, but SELECT only – how to do this?
I have found solution and it is rather easy. Load script should look as below:
[Kategorie CategoryDefinition]:
LOAD
[CATEGORYID] AS [ID kategorii],
[CATEGORYNAME] AS [Kategoria];
SELECT CATEGORYID,
CATEGORYNAME
FROM "servicedeskit_backup".dbo.CategoryDefinition
WHERE categoryname COLLATE SQL_Latin1_General_CP1_CI_AS = N'Awarie'
OR categoryname COLLATE SQL_Latin1_General_CP1_CI_AS = N'Bezpieczeństwo'
OR categoryname COLLATE SQL_Latin1_General_CP1_CI_AS = N'Wnioski';
Collate is not necessary for categories without polish characters, but I leave it as it is.