为了美化页面,防止列表中字数过多。在SQL语句中根据字符长度判断,如果字符超常,则显示为有限字符加”…”。select Case when Len(ShowFiled)>50 then Substring(ShowFiled,1,50)+’…’ else ShowFiled End as ShowFiled from Table
/******* 导出到excel EXEC master..xp_cmdshell ‘bcp SettleDB.dbo.shanghu out c:\temp1.xls -c -q -S”GNETDATA/GNETDATA” -U”sa” -P”"‘ /*********** 导入Excel Select * FROM OpenDataSource( ‘Microsoft.Jet.OLEDB.4.0′, ‘Data Source=”c:\test.xls”;User ID=Admin;Password=;Extended properties=Excel 5.0′)…xa...
--导入数据插入标识列,ID重复则替换,旧表中没有的列用'abc' as Field进行插入
SET IDENTITY_INSERT NetCMS.dbo.NT_channel_video ON
insert into NetCMS.dbo.NT_channel_video(Id,title,ch_videourl,Author,Souce,CreatTime,[Content],NaviContent,ChID,ClassID,OrderID,
isdelpoint,isHTML,isConstr,ConstrTF,TitleITF,TitleBTF,ContentProper...
use 数据库名
declare @tname varchar(8000)
set @tname=''
select @tname=@tname + Name + ',' from sysobjects where xtype='U'
select @tname='drop table ' + left(@tname,len(@tname)-1)
exec(@tname)
- «
- 1
- 2