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%
]
相關文章
- Oracle中匯出修復資料塊損壞Oracle
- sql匯出SQL
- navlicat 匯入匯出SQLSQL
- mysql 匯入匯出 sql檔案MySql
- SQL語句匯入匯出大全SQL
- SQL Anywhere db檔案損壞修復 DB檔案修復 DB資料庫修復SQL資料庫
- 修復PLSQL Developer 與 Office 2010的整合匯出Excel 功能SQLDeveloperExcel
- Navicat 匯出sql問題SQL
- 匯出ddl定義.sqlSQL
- SQL Server的MDF檔案恢復/修復方法SQLServer
- SQL一致性錯誤修復SQLSQL
- SQL資料庫的匯入和匯出SQL資料庫
- Navicat如何匯入和匯出sql檔案SQL
- (轉)excel和sql server的匯入匯出ExcelSQLServer
- [zt] SQL Server匯出匯入資料方法SQLServer
- Mongodb的備份恢復與匯出匯入MongoDB
- SQL Server 資料頁損壞修復SQLServer
- 網站被sql注入的修復方法網站SQL
- 匯出db link的SQLSQL
- ubuntu 下mysql匯入和匯出.sql檔案UbuntuMySql
- SQL Server匯入、匯出、備分資料方法SQLServer
- SQL SERVER 和EXCEL的資料匯入匯出SQLServerExcel
- WordPress 5.1.1 釋出 修復 CSRF 漏洞
- dataguard備庫出現GAP修復
- Dcat Admin 使用 Laravel Octane 時匯出功能無法使用的原因及修復方法Laravel
- 資料庫SQL Server DAC 匯入匯出資料到SQL Azure問題資料庫SQLServer
- 今天修復資料寫了個pl/sqlSQL
- 【SQL】Oracle BLOB 批量匯入匯出圖片語句SQLOracle
- Oracle pl/sql 複製表 資料匯入 匯出OracleSQL
- wxPython 安全修復版本4.0.1釋出Python
- Nacos 2.3.2 正式釋出,修復重大 bug!
- SQL Server 2008匯入、匯出資料庫SQLServer資料庫
- 在SQL Server資料庫中匯入匯出資料SQLServer資料庫
- 修復SQL隱碼攻擊漏洞 兩種方法SQL
- Docker容器中的備份、恢復、遷移、匯入、匯出Docker
- Oracle備份與恢復系列 五 邏輯匯入匯出Oracle
- 匯入sql檔案出現亂碼SQL
- PrestaShop網站漏洞修復如何修復REST網站