sql server data type to kusto data types

Bexy Morgan 255 Reputation points
2023-10-05T15:40:51.5066667+00:00

while creating external table from sql db in ADX, sql table has columns of type varchar and nvarchar.

While creating external table, what is the equivalent data type for varchar , varchar and [NVARCHAR] respectively in kusto ?

Azure Data Explorer
Azure Data Explorer
An Azure data analytics service for real-time analysis on large volumes of data streaming from sources including applications, websites, and internet of things devices.
508 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. KranthiPakala-MSFT 46,442 Reputation points Microsoft Employee
    2023-10-05T23:26:18.4233333+00:00

    @Bexy Morgan Welcome to Microsoft Q&A forum and thanks for reaching out here.

    In Kusto, the equivalent data type for varchar is string. For nvarchar, there is no direct equivalent data type in Kusto. Azure Data Explorer has only one string type and for SQL clients it's encoded as NVARCHAR(MAX).

    In case if you have a requirement to limit the string with a specific constant size (similar to that of e.g. NVARCHAR(5000)), Azure Data Explorer offers a different workaround. You can configure Azure Data Explorer to encode all strings as NVARCHAR(n) via a connection string. The language field in the connection string can be used to specify tuning options in the format, language@OptionName1:OptionValue1,OptionName2:OptionValue2.

    For example, the following connection string will instruct Azure Data Explorer to encode strings as NVARCHAR(5000).

    "Driver={ODBC Driver 17 for SQL Server};Server=mykustocluster.kusto.windows.net;Database=mykustodatabase;Authentication=ActiveDirectoryIntegrated,Language=any@MaxStringSize:5000"
    

     

    Hope this info helps.


    Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.