婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁(yè) > 知識(shí)庫(kù) > 將表數(shù)據(jù)生成Insert腳本 比較好用的生成插入語(yǔ)句的SQL腳本

將表數(shù)據(jù)生成Insert腳本 比較好用的生成插入語(yǔ)句的SQL腳本

熱門標(biāo)簽:申請(qǐng)400電話在哪辦理流程 電銷外呼有錄音系統(tǒng)有哪些 臨沂智能電銷機(jī)器人加盟哪家好 鎮(zhèn)江網(wǎng)路外呼系統(tǒng)供應(yīng)商 貴州房產(chǎn)智能外呼系統(tǒng)供應(yīng)商 外呼運(yùn)營(yíng)商線路收費(fèi) 小e電話機(jī)器人 一個(gè)導(dǎo)航軟件能用幾個(gè)地圖標(biāo)注點(diǎn) 百度地圖標(biāo)注改顏色
復(fù)制代碼 代碼如下:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
-- =============================================
-- Author: 華嶺
-- Create date: 2008-10-28
-- Description: 將表數(shù)據(jù)生成Insert腳本
-- Demo : exec pCreateInsertScript 'BexmCodeType','dictypeid = 61'
-- =============================================
alter proc [dbo].pCreateInsertScript (@tablename varchar(256),@con nvarchar(400))
as
begin
set nocount on
declare @sqlstr varchar(4000)
declare @sqlstr1 varchar(4000)
declare @sqlstr2 varchar(4000)
select @sqlstr='select ''insert '+@tablename
select @sqlstr1=''
select @sqlstr2='('
select @sqlstr1='values (''+'
select @sqlstr1=@sqlstr1+col+'+'',''+' ,@sqlstr2=@sqlstr2+name +',' from (select case
when a.xtype =173 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.length*2+2)+'),'+a.name +')'+' end'
when a.xtype =104 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(1),'+a.name +')'+' end'
when a.xtype =175 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end'
when a.xtype =61 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'convert(varchar(23),'+a.name +',121)'+ '+'''''''''+' end'
when a.xtype =106 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.xprec+2)+'),'+a.name +')'+' end'
when a.xtype =62 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(23),'+a.name +',2)'+' end'
when a.xtype =56 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(11),'+a.name +')'+' end'
when a.xtype =60 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(22),'+a.name +')'+' end'
when a.xtype =239 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end'
when a.xtype =108 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.xprec+2)+'),'+a.name +')'+' end'
when a.xtype =231 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end'
when a.xtype =59 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(23),'+a.name +',2)'+' end'
when a.xtype =58 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'convert(varchar(23),'+a.name +',121)'+ '+'''''''''+' end'
when a.xtype =52 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(12),'+a.name +')'+' end'
when a.xtype =122 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(22),'+a.name +')'+' end'
when a.xtype =127 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(6),'+a.name +')'+' end'
when a.xtype =48 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(6),'+a.name +')'+' end'
when a.xtype =165 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.length*2+2)+'),'+a.name +')'+' end'
when a.xtype =167 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end'
else '''NULL'''
end as col,a.colid,a.name
from syscolumns a where a.id = object_id(@tablename)
and a.xtype >189 and a.xtype >34 and a.xtype >35 and a.xtype >36
)t order by colid
select @sqlstr=@sqlstr+left(@sqlstr2,len(@sqlstr2)-1)+') '+left(@sqlstr1,len(@sqlstr1)-3)+')'' from '+@tablename + ' where 1=1 and ' + isnull(@con,'')
print @sqlstr
exec( @sqlstr)
set nocount off
end

標(biāo)簽:日照 澳門 嘉興 晉城 三明 合肥 保定 延邊

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《將表數(shù)據(jù)生成Insert腳本 比較好用的生成插入語(yǔ)句的SQL腳本》,本文關(guān)鍵詞  將,表,數(shù)據(jù),生成,Insert,腳本,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《將表數(shù)據(jù)生成Insert腳本 比較好用的生成插入語(yǔ)句的SQL腳本》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于將表數(shù)據(jù)生成Insert腳本 比較好用的生成插入語(yǔ)句的SQL腳本的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 赣榆县| 阳谷县| 桐庐县| 佛坪县| 宿迁市| 威宁| 东源县| 开江县| 平利县| 儋州市| 平乐县| 肇庆市| 黔江区| 桐庐县| 汽车| 棋牌| 大悟县| 安徽省| 迭部县| 禹州市| 民乐县| 集贤县| 宁城县| 灌云县| 柳河县| 翼城县| 惠来县| 察雅县| 巴里| 资溪县| 琼结县| 余干县| 驻马店市| 怀远县| 宾阳县| 小金县| 克什克腾旗| 徐汇区| 墨江| 贵定县| 南召县|