dbeaver / dbeaver/dbeaver

Table export to container -- MS_Description issues, (not exported to target schema, no unicode support)

Open
#5,870 1 comment 0 reactions 0 assignees View on GitHub
enhancement x:mssql xf:datatransfer
Dominant language
Java
Stars
51.8k
Forks
4.4k
Avg merge
3d 8h
Merged PRs (30d)
188

Description

#### System information:
- Operating system (distribution) and version
Windows 10 64 bit
- DBeaver version
6.0.4
- Java version
JRE8 , JDK12
- Additional extensions
No

#### Connection specification:
- Database name and version
AWS RDS:
Microsoft SQL Server 2017 (RTM-CU13-OD) (KB4483666) - 14.0.3049.1 (X64)
Dec 15 2018 11:16:42
Copyright (C) 2017 Microsoft Corporation
Web Edition (64-bit) on Windows Server 2016 Datacenter 10.0 (Build 14393: ) (Hypervisor)

- Driver name
MSSQL JDBC 7.2
- Do you use tunnels or proxies (SSH, SOCKS, etc)?
NO

#### Describe the problem you're observing:
1)
When I want to export a new table-X from schema-1 to schema-2.
I have both table description and column description prepared on schema-1 on the table-X
However, when the export completed, only the column description are moved to the schema-2.
The table description has to be manually typed in the schema-2.
It seems that extra T-SQL is needed to maintain the schema-2 same the schema-1 ( here is an example SQL).

2)
Also, when the user tried to edit a database that is Unicode based RDS on AWS, the default stored SQL for persisting data is not working for Chinese Characters. '??' will be shown after the user confirmed to persist the data.

#### Current solution to deal with this issue :
Assumptions :
TableName : Glossary, SchemaName=dbo, DBName=cma_dev

Original T-SQL : (NOT WORKING for AWS RDS MSSQL Server due to unicode encoding.)
```
EXEC cma_dev.sys.sp_updateextendedproperty 'MS_Description', '術語翻譯', 'schema', 'dbo', 'table', 'Glossary' GO
```

T-SQL Example : (WORKED SCRIPT to UPDATE for Unicode encoded database)
- TO ADD (This script is what I believe missing in the exporting process, in such case there was no property defined earlier.)
```
--EXEC cma_dev.sys.sp_addextendedproperty @name=N'MS_Description', @value=N'術語翻譯' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Glossary'
```
- TO UPDATE
```
--EXEC cma_dev.sys.sp_updateextendedproperty @name=N'MS_Description', @value=N'術語翻譯' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Glossary'
```

#### Steps to reproduce, if exist:
Pretty much this issue can be done manually generate the SQL on excel or any other tools after query all the table & its description info (see info below) and generate script as above to update all table description updated later on.

Example Script to get Table_Desc :
```
"SELECT
t.name,
t.object_id,
sep.class,
sep.major_id,
sep.minor_id,
sep.value as [TABLE_DESC]
FROM
sys.tables t
INNER JOIN
sys.extended_properties sep ON t.object_id = sep.major_id
where
sep.Name = 'MS_Description'
AND sep.minor_id = 0 -- not any column - but the table's description"
```

#### Include any warning/errors/backtraces from the logs

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.