• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            牽著老婆滿街逛

            嚴(yán)以律己,寬以待人. 三思而后行.
            GMail/GTalk: yanglinbo#google.com;
            MSN/Email: tx7do#yahoo.com.cn;
            QQ: 3 0 3 3 9 6 9 2 0 .

            SQL Server 2005導(dǎo)出表中數(shù)據(jù)的SQL腳本形式

            CREATE   proc sp_GenInsertSQL (@tablename varchar(256))
            as
            begin
            declare @sql varchar(8000)
            declare @sqlValues varchar(8000)
            set @sql =' ('
            set @sqlValues = 'values (''+'
            select @sqlValues = @sqlValues + cols + ' + '','' + ' ,@sql = @sql + '[' + name + '],'
            from
                  (
            select case
                            
            when xtype in (48,52,56,59,60,62,104,106,108,122,127)       

                                 
            then 'case when '+ name +' is null then ''NULL'' else ' + 'cast('+ name + ' as varchar)'+' end'

                            
            when xtype in (58,61)

                                 
            then 'case when '+ name +' is null then ''NULL'' else '+''''''''' + ' + 'cast('+ name +' as varchar)'+ '+'''''''''+' end'

                           
            when xtype in (167)

                                 
            then 'case when '+ name +' is null then ''NULL'' else '+''''''''' + ' + 'replace('+ name+','''''''','''''''''''')' + '+'''''''''+' end'

                            
            when xtype in (231)

                                 
            then 'case when '+ name +' is null then ''NULL'' else '+'''N'''''' + ' + 'replace('+ name+','''''''','''''''''''')' + '+'''''''''+' end'

                            
            when xtype in (175)

                                 
            then 'case when '+ name +' is null then ''NULL'' else '+''''''''' + ' + 'cast(replace('+ name+','''''''','''''''''''') as Char(' + cast(length as varchar+ '))+'''''''''+' end'

                            
            when xtype in (239)

                                 
            then 'case when '+ name +' is null then ''NULL'' else '+'''N'''''' + ' + 'cast(replace('+ name+','''''''','''''''''''') as Char(' + cast(length as varchar+ '))+'''''''''+' end'

                            
            else '''NULL'''

                          
            end as Cols,name

                     
            from syscolumns 

                    
            where id = object_id(@tablename)

                  ) T
            set @sql ='select ''INSERT INTO ['+ @tablename + ']' + left(@sql,len(@sql)-1)+'' + left(@sqlValues,len(@sqlValues)-4+ ')'' from '+@tablename
            print @sql
            exec (@sql)
            end
            GO


            然后執(zhí)行:
            exec sp_GenInsertSQL '表名'

            posted on 2013-12-09 00:18 楊粼波 閱讀(958) 評(píng)論(0)  編輯 收藏 引用


            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            人妻丰满AV无码久久不卡| 97久久精品国产精品青草| 久久99精品久久久久久hb无码| 久久精品国产亚洲av日韩| 久久国产欧美日韩精品| 久久久青草青青亚洲国产免观| 久久精品国产只有精品2020| 国产精品综合久久第一页| 亚洲AV无码久久精品色欲| 久久久久久一区国产精品| 久久人人爽人人爽人人片av高请| 久久精品无码一区二区三区免费| 中文字幕无码精品亚洲资源网久久| 久久精品这里热有精品| 久久天天躁狠狠躁夜夜2020一| 久久久久久久国产免费看| 久久不见久久见免费视频7| 性欧美大战久久久久久久| 欧美日韩中文字幕久久伊人| 久久精品天天中文字幕人妻| 精品久久久久久无码不卡| 亚洲国产精品嫩草影院久久 | 国产ww久久久久久久久久| 久久久久亚洲AV无码麻豆| 东方aⅴ免费观看久久av| 欧美午夜A∨大片久久| 狠狠色综合久久久久尤物| 国产精品无码久久综合| 精品久久久久久无码专区不卡| 伊人久久大香线蕉亚洲五月天| 久久国产劲爆AV内射—百度| 亚洲午夜无码AV毛片久久| 久久久久女教师免费一区| 久久久青草青青国产亚洲免观| 久久国产V一级毛多内射| 久久影院久久香蕉国产线看观看| 久久国产精品免费| 伊人色综合久久天天网| 久久人人爽人人爽人人爽| 亚洲欧美成人综合久久久| av午夜福利一片免费看久久|