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

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

SQL SERVER數據導成INSERT

瀏覽:151日期: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 數據庫
主站蜘蛛池模板: 介休市| 明光市| 西畴县| 沈阳市| 翁牛特旗| 邳州市| 应城市| 孟村| 印江| 荃湾区| 灵山县| 容城县| 襄樊市| 康保县| 丰县| 石门县| 理塘县| 梨树县| 苍山县| 靖远县| 新民市| 睢宁县| 尚志市| 获嘉县| 江口县| 永胜县| 三门峡市| 平罗县| 托里县| 浪卡子县| 霍林郭勒市| 天等县| 南阳市| 黑河市| 沧州市| 宣汉县| 临江市| 靖西县| 鹿泉市| 梧州市| 务川|