SQL2000中使用Sql2005生成的建表腳本
來源:程序員人生 發布時間:2014-04-28 21:15:50 閱讀次數:5195次
首先在所選的數據庫上右鍵,任務,生成腳本。生成過程中,注意選擇目標數據庫為SQL Server2000.
第二,這個腳本是不能在SQL2000的查詢分析器中使用的,通過如下的Emeditor宏來轉換吧:
function TSql2005_2000(sql)
{
return sql.replace(/WITHs*(.*?)/g,'')
.replace(/(sys.objects)|(sys.views)|(sys.indexes)/g,'sysobjects')
.replace(/object_id/g,'id')
.replace(/execs+sys.sp_addextendedproperty.+$/gmi,function(line){
return line.replace(/sys.sp_addextendedproperty/g,'dbo.sp_addextendedproperty')
//@level0type=N''SCHEMA''改成@level0type=N''user'',再把@name=,@value =,@level0type=,@level0name=,@level1type=,@level1name=全部替代為空
.replace(/@level0type=N?'.+?'/,"@level0type=N'user'")
.replace(/@level0type=N?'.+?'/,"@level0type=N'user'");
});
}
document.selection.Text=TSql2005_2000(document.selection.Text)
出處:http://evlon.cnblogs.com
生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈