久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

SQL SERVER數據導成INSERT

瀏覽:135日期:2023-11-01 15:46:52

create;;procspGenInsertSQL @TableNameasvarchar(100) as --declare@TableNamevarchar(100) --set@TableName='orders' --set@TableName='eeducation' DECLARExCursorCURSORFOR SELECTname,xusertype FROMsyscolumns WHERE(id=OBJECT_ID(@TableName)) declare@F1varchar(100) declare@F2integer declare@SQLvarchar(8000) set@sql='SELECT''INSERTINTO'+@TableName+'VALUES(''' OPENxCursor FETCHxCursorinto@F1,@F2 WHILE@@FETCH_STATUS=0 BEGIN set@sql=@sql + +casewhen@F2IN(35,58,99,167,175,231,239,61)then'+casewhen'+@F1+'ISNULLthen''''else''''''''end+';;else'+'end +'replace(ISNULL(cast('+@F1+'asvarchar(8000)),''NULL''),'''''''','''''''''''')';; +casewhen@F2IN(35,58,99,167,175,231,239,61)then'+casewhen'+@F1+'ISNULLthen''''else''''''''end+';;else'+'end +char(13)+''',''';; FETCHNEXTFROMxCursorinto@F1,@F2 END CLOSExCursor DEALLOCATExCursor set@sql=left(@sql,len(@sql)-5)+'+'')''FROM'+@TableName exec(@sql) go

EXEC spGenInsertSQL *TBLNAME*

標簽: Sql Server 數據庫
主站蜘蛛池模板: 安溪县| 临沭县| 修水县| 布尔津县| 潼南县| 武汉市| 巩留县| 石嘴山市| 广丰县| 上高县| 新巴尔虎左旗| 县级市| 宜兰市| 赤水市| 彭水| 江陵县| 博白县| 新疆| 吉林市| 重庆市| 塔河县| 中牟县| 谷城县| 三都| 无锡市| 屏山县| 山东省| 七台河市| 达日县| 永新县| 竹北市| 达拉特旗| 固始县| 外汇| 新竹县| 临高县| 育儿| 扎囊县| 乳山市| 板桥市| 彭山县|