PowerDesigner16匯出Sql修復
最近在對公司的系統做重構,用了pd16,匯出到sqlserver2008時,出了一些問題,以前碰到過解決了,但再次碰到時,還是要查閱資料,所以這次把解決辦法分享出來。
一,在資料庫中建立SysProperties檢視
if exists (select 1 from sysobjects where name = 'sysproperties'and xtype = 'V')
begin
DROP VIEW sysproperties
end
GO
CREATE VIEW sysproperties
AS
SELECT A.name As TableName,
A.id As TableID,B.Name As ColName,B.colid As ColID,
B.xtype As ColType,C.name As PropName,C.Value As PropValue
FROM sysobjects As A INNER JOIN syscolumns As B ON A.id = B.id
INNER JOIN sys.extended_properties As C ON C.major_id = A.id
AND ( minor_id = B.colid)
二,修改Table TableComment模板 路徑是 Database -> Edit Current DBMS 窗體 General 選項卡 下 Script -> Objects -> Table -> TableComment
[if exists (select 1
from sys.extended_properties
where major_id = object_id('[%QUALIFIER%]%TABLE%')
and minor_id = 0 and name = 'MS_Description')
begin
[%OWNER%?[.O:[execute ][exec ]]sp_dropextendedproperty [%R%?[N]]'MS_Description',
[%R%?[N]]'user', [%R%?[N]]%.q:OWNER%, [%R%?[N]]'table', [%R%?[N]]%.q:TABLE%
:declare @CurrentUser sysname
select @CurrentUser = user_name()
[.O:[execute ][exec ]]sp_dropextendedproperty [%R%?[N]]'MS_Description',
[%R%?[N]]'user', [%R%?[N]]@CurrentUser, [%R%?[N]]'table', [%R%?[N]]%.q:TABLE%
]
end
][%OWNER%?[.O:[execute ][exec ]]sp_addextendedproperty [%R%?[N]]'MS_Description',
[%R%?[N]]%.q:COMMENT%,
[%R%?[N]]'user', [%R%?[N]]%.q:OWNER%, [%R%?[N]]'table', [%R%?[N]]%.q:TABLE%
:select @CurrentUser = user_name()
[.O:[execute ][exec ]]sp_addextendedproperty [%R%?[N]]'MS_Description',
[%R%?[N]]%.q:COMMENT%,
[%R%?[N]]'user', [%R%?[N]]@CurrentUser, [%R%?[N]]'table', [%R%?[N]]%.q:TABLE%
]
三,修改Column ColumnComment模板 路徑是 Database -> Edit Current DBMS 窗體 General 選項卡 下 Script -> Objects -> Column -> ColumnComment
[if exists (select 1
from sysproperties
where TableID = object_id('[%QUALIFIER%]%TABLE%')
and ColName = %.q:COLUMN% AND PropName='MS_Description')
begin
[%OWNER%?[.O:[execute ][exec ]]sp_dropextendedproperty [%R%?[N]]'MS_Description',
[%R%?[N]]'user', [%R%?[N]]%.q:OWNER%, [%R%?[N]]'table', [%R%?[N]]%.q:TABLE%, [%R%?[N]]'column', [%R%?[N]]%.q:COLUMN%
:declare @CurrentUser sysname
select @CurrentUser = user_name()
[.O:[execute ][exec ]]sp_dropextendedproperty [%R%?[N]]'MS_Description',
[%R%?[N]]'user', [%R%?[N]]@CurrentUser, [%R%?[N]]'table', [%R%?[N]]%.q:TABLE%, [%R%?[N]]'column', [%R%?[N]]%.q:COLUMN%
]
end
][%OWNER%?[.O:[execute ][exec ]]sp_addextendedproperty [%R%?[N]]'MS_Description',
[%R%?[N]]%.q:COMMENT%,
[%R%?[N]]'user', [%R%?[N]]%.q:OWNER%, [%R%?[N]]'table', [%R%?[N]]%.q:TABLE%, [%R%?[N]]'column', [%R%?[N]]%.q:COLUMN%
:select @CurrentUser = user_name()
[.O:[execute ][exec ]]sp_addextendedproperty [%R%?[N]]'MS_Description',
[%R%?[N]]%.q:COMMENT%,
[%R%?[N]]'user', [%R%?[N]]@CurrentUser, [%R%?[N]]'table', [%R%?[N]]%.q:TABLE%, [%R%?[N]]'column', [%R%?[N]]%.q:COLUMN%
]
相關文章
- sql匯出SQL
- navlicat 匯入匯出SQLSQL
- SQL Anywhere db檔案損壞修復 DB檔案修復 DB資料庫修復SQL資料庫
- Navicat 匯出sql問題SQL
- SQL資料庫的匯入和匯出SQL資料庫
- Navicat如何匯入和匯出sql檔案SQL
- SQL Server 資料頁損壞修復SQLServer
- Microsoft SQL Server 2016 with SP3 GDR 釋出,修復高危安全漏洞ROSSQLServer
- SQL Server 2014 匯出資料字典SQLServer
- Mongodb的備份恢復與匯出匯入MongoDB
- 【SQL】Oracle BLOB 批量匯入匯出圖片語句SQLOracle
- Dcat Admin 使用 Laravel Octane 時匯出功能無法使用的原因及修復方法Laravel
- 匯入sql檔案出現亂碼SQL
- WordPress 5.1.1 釋出 修復 CSRF 漏洞
- Nacos 2.3.2 正式釋出,修復重大 bug!
- Docker容器中的備份、恢復、遷移、匯入、匯出Docker
- SQLSERVER匯出TXT文字檔案,ORACLE SQL LOADER匯入TXT文字檔案SQLServerOracle
- metinfo sql注入漏洞修復建議與防範辦法SQL
- Mutter 3.35.1 已釋出–修復多項BUG
- PrestaShop網站漏洞修復如何修復REST網站
- 記錄一次亂碼問題修復經歷!排查修復Poi-tl使用HttpServletResponse匯出Word亂碼問題HTTPServlet
- 怎麼修復網站漏洞之metinfo遠端SQL隱碼攻擊漏洞修補網站SQL
- Android熱修復原理(一)熱修復框架對比和程式碼修復Android框架
- SQL Server 匯出Excel有換行的解決方法SQLServerExcel
- win10 如何修復game bar win10game bar出現問題怎麼修復Win10GAM
- SQL故障修復的生命線:Pssdiag和Sqldiag管理器OLSQL
- 網站漏洞修復SQL隱碼攻擊防護辦法網站SQL
- Swoole v4.6.1 版本釋出,Bug 修復版本
- 修復IAT
- PostgreSQL邏輯備份恢復--pg_dump匯出及psql匯入案例SQL
- oracl 資料庫 sqlplus 匯出資料為sql檔案資料庫SQL
- 修復PG.conf檔案出現的問題
- dedecms資料庫檔案出錯的修復方法資料庫
- Activity 流程模型匯入匯出-activity流程模型匯入匯出模型
- Mysql匯入&匯出MySql
- doris匯入匯出
- esayExcel匯入匯出Excel
- .sql檔案匯入到sql server中SQLServer
- Android 熱修復Android