Skip to content

MSSQL: Data of type varchar disappears when the database server character encoding is chinese #662

@BlueHtml

Description

@BlueHtml

Introduction

Hello, in MSSQL, when the field type is varchar, its value disappears. This issue occurs with both the CSV component and the JSON component.

JSON Component

The SQL is as follows:

select 'json' AS component, 'array' AS type;

select top 2 * from [Ban].[dbo].[ErrorLog];
select 'INFO' as LogLevel;
select CAST('INFO' as varchar(100)) as LogLevel;

The MSSQL execution result is as follows:
image

The JSON component execution result is as follows (The values of LogLevel and LogSource are missing):

[
{"ID":1,"LogTime":"2023-01-31T08:26:25.573+00:00","LogLevel":"","LogSource":"","Message":"默认数量:minWorker:4,minIOC:1;设置:300","Exception":""},
{"ID":2,"LogTime":"2023-01-31T08:26:26.100+00:00","LogLevel":"","LogSource":"","Message":"conf加载成功","Exception":""},
{"LogLevel":"INFO"},
{"LogLevel":""}
]

CSV Component

The SQL is as follows:

select 
    'csv'              as component,
    'Download my data' as title,
    'people'           as filename,
    'file-download'    as icon,
    'green'            as color,
    TRUE               as bom;

select top 2 * from [Ban].[dbo].[ErrorLog];
select 'INFO' as LogLevel;
select CAST('INFO' as varchar(100)) as LogLevel;

The MSSQL execution result is as follows:
image

The CSV component execution result is as follows (The values of LogLevel and LogSource are missing):

ID,LogTime,LogLevel,LogSource,Message,Exception
1,2023-01-31T08:26:25.573+00:00,,,"默认数量:minWorker:4,minIOC:1;设置:300",
2,2023-01-31T08:26:26.100+00:00,,,conf加载成功,
,,INFO,,,
,,,,,

The MSSQL table creation statement and data types are as follows:

CREATE TABLE [dbo].[ErrorLog](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[LogTime] [datetime] NOT NULL,
	[LogLevel] [varchar](100) NOT NULL,
	[LogSource] [varchar](200) NOT NULL,
	[Message] nvarchar(MAX) NOT NULL,
	[Exception] nvarchar(MAX) NOT NULL,
)

Version information

  • OS: windowns 10 Simplified Chinese zh-CN
  • Database: MSSQL
  • SQLPage Version: v0.30.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions