久久机这里只有精品,国产69精品一区二区亚洲孕妇,91精品国产综合久久婷婷香蕉,午夜久久久久久电影

最新活動:電腦PC端+手機端+微網(wǎng)站+自適應網(wǎng)頁多模板選擇-建站388元起價!!!
當前位置:主頁 > 網(wǎng)站建設 > sqlserver 導出插入腳本代碼建站知識

sqlserver 導出插入腳本代碼建站知識

時間:2023-05-22 09:05:22 閱讀: 文章分類: 網(wǎng)站建設 作者: 網(wǎng)絡小編

導讀:1建站知識工作中經(jīng)常遇到需要將遠程客戶數(shù)據(jù)庫中的數(shù)據(jù)復制到本地來測試,下載整個數(shù)據(jù)庫太大了不值得,用下面的腳本可網(wǎng)站建設教程網(wǎng)站seo優(yōu)化軟件。

網(wǎng)站建設教程網(wǎng)站seo優(yōu)化軟件當然有其它工具可以做這件事,但如果客戶不允許你在服務器亂裝東西時這個腳本就會有用了。

復制代碼 代碼如下:

DECLARE @tbImportTables table(tablename varchar(128), deleted tinyint) -- append tables which you want to import Insert Into @tbImportTables(tablename, deleted) values('tentitytype', 1) Insert Into @tbImportTables(tablename, deleted) values('tattribute', 1) -- append企業(yè)網(wǎng)站建設 all tables --Insert Into @tbImportTables(tablename, deleted) select table_name, 1 from INFORMATION_SCHEMA.tables where table_type = 'BASE TABLE' DECLARE @tbImportScripts table(script varchar(max)) Declare @tablename varchar(128), @deleted tinyint, @columnname varchar(128), @fieldscript varchar(max), @valuescript varchar(max), @insertscript varchar(max) Declare curImportTables Cursor For Select tablename, deleted From @tbImportTables Open curImportTables Fetch Next From curImportTables Into @tablename, @deleted WHILE @@Fetch_STATUS = 0 Begin   If (@deleted = 1)   begin     Insert into @tbImportScripts(script) values ('Truncate table ' + @tablename)   end   Inse網(wǎng)站建設公司rt into @tbImportScripts(script) values ('SET IDENTITY_INSERT ' + @tablename + ' ON')   set @fieldscript = ''   select @fieldscript = @fieldscript + column_name + ',' from INFORMATION_SCHEMA.columns where table_name = @tablename and data_type not in('timestamp', 'image')   set @fieldscript = substring(@fieldscript, 0, len(@fieldscript))   set @valuescript = ''   select @valuescript = @valuescript + 'case when ' + column_name + ' is null then ''null'' else '''''''' + convert(varchar(max), ' + column_name + ') + '''''''' end +'',''+'   from INFORMATION_SCHEMA.columns where table_name = @tablename and data_type not in('timestamp', 'image')   set @valuescript = substring(@valuescript, 0, len(@valuescript) - 4)   set @insertscript = 'select ''insert into ' + @tablename + '(' + @fieldscript + ') values(' + '''+' + @valuescript + ' + '')'' from ' + @tablename   Insert into @tbImportScripts(script) exec ( @insertscript)   Insert into @tbImportScripts(script) values ('SET IDENTITY_INSERT ' + @tablename + ' OFF')   Insert into @tbImportScripts(script) valu網(wǎng)站建設教程es ('GO ')   Fetch Next From curImportTables Into @tablename, @deleted End Close curImportTables Deallocate curImportTables Select * from @tbImportScripts

相關(guān)網(wǎng)站建設教程網(wǎng)站seo優(yōu)化軟件。

關(guān)鍵詞標簽: 標簽 腳本

聲明: 本文由我的SEOUC技術(shù)文章主頁發(fā)布于:2023-05-22 ,文章sqlserver 導出插入腳本代碼建站知識主要講述腳本,標簽,sqlserver 導出插入腳本代碼建站知識1網(wǎng)站建設源碼以及服務器配置搭建相關(guān)技術(shù)文章。轉(zhuǎn)載請保留鏈接: http://www.bifwcx.com/article/web_4281.html

我的IDC 網(wǎng)站建設技術(shù)SEOUC.COM
專注網(wǎng)站建設,SEO優(yōu)化,小程序設計制作搭建開發(fā)定制網(wǎng)站等,數(shù)千家網(wǎng)站定制開發(fā)案例,網(wǎng)站推廣技術(shù)服務。
  • 5000+合作客服
  • 8年從業(yè)經(jīng)驗
  • 150+覆蓋行業(yè)
  • 最新熱門源碼技術(shù)文章

    主站蜘蛛池模板: 姚安县| 东安县| 滦南县| 隆德县| 西藏| 同心县| 西和县| 盐源县| 类乌齐县| 青州市| 东阿县| 隆林| 池州市| 彝良县| 张家川| 新邵县| 炉霍县| 青铜峡市| 县级市| 南涧| 兴和县| 嵊泗县| 陈巴尔虎旗| 涿鹿县| 收藏| 伊金霍洛旗| 镇平县| 万年县| 玉林市| 龙泉市| 依安县| 红桥区| 凤庆县| 辉县市| 麻阳| 澄迈县| 乌审旗| 清镇市| 大洼县| 合山市| 车致|