Sql 2009 to jsonl ...

Carlos Arizmendi 41 Reputation points
2021-12-08T23:26:59.99+00:00

Hi guys !!!

Does anyone know if is possible to export a table from SQL 2019 to the version name jsonl file ???

Thanks so much !!!

Kind regards.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,361 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. CathyJi-MSFT 21,131 Reputation points Microsoft Vendor
    2021-12-09T00:43:20.28+00:00

    Hi @CarlosArizmendi-1254,

    We can export data in SQL to JSON text, but not .JSONL File. JSON functions is supported from SQL 2016 to later. Format SQL Server data or the results of SQL queries as JSON by adding the FOR JSON clause to a SELECT statement.

    Please refer to MS document Convert SQL Server data to JSON or export JSON or the blog to get more details.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    1 person found this answer helpful.
    0 comments No comments

  2. Carlos Arizmendi 41 Reputation points
    2021-12-09T14:12:22.977+00:00

    Thanks so much !!!

    So the only way is to export in a format like JSON or CSV and after transform it to JSONL.

    I'm right ???

    Thanks so much !!!


  3. Yitzhak Khabinsky 25,731 Reputation points
    2021-12-09T18:02:44.887+00:00

    Hi @Carlos Arizmendi ,

    It is easy to achieve by using a so called SQLCMD mode in SSMS.

    Check it out.

    SQL

    -- To change to SQLCMD Mode - select Query from the menu and then select SQLCMD Mode.  
    -- file will be generated on the machine where SSMS is running !!!  
      
    :out E:\Temp\currencyCodes.json  
      
    SET NOCOUNT ON;  
      
    SELECT *  
    FROM [AdventureWorks].[Sales].[Currency]  
    FOR JSON PATH, INCLUDE_NULL_VALUES;  
    GO  
    
    0 comments No comments