SQL Server 快速換表名

2022-03-27 05:32:53 字數 394 閱讀 7355

經常在我們的業務系統中,表的增長比較快,表的資料量非常龐大,這時我們需要建立乙個新表來替代它,那怎麼快速的把這新錶方上去呢?如人工操作,有可能是會影響業務系統的,所以我們考慮用命令的方式來處理。

主要的方式是就是使用系統自帶的儲存過程:sp_rename

exec sp_rename 'oldtable','newtable'

exec sp_rename '

oldtable

','newtable

'exec sp_rename '

newtable

','oldtable

'經過如下轉換,新錶變成與舊表就互相換了一下名字,對系統基本沒有影響。

在 中的技術文件中有我平時總結的一些經驗,並在逐步更新中,也歡迎到這裡來交流。

查詢SQL Server中的表名

sqlconnection conn new sqlconnection server uid sa pwd 123 database 08 09cgywdb connection timeout 2 conn.open sqlcommand comm new sqlcommand select o...

Sql Server 查詢表名的備註

查詢表名描述 ms description select tbs.name 表名,ds.value 描述 from sys.extended properties ds left join sysobjects tbs on ds.major id tbs.id where ds.minor id ...

將Excel 表快速匯入sqlserver

從exce表中直接匯入到資料庫中 private void barbuttonitem從excel匯入 itemclick object sender,devexpress.xtrabars.itemclickeventargs e while read.nextresult read.close ...