创建一个新数据库
create database JJTeachDB--创建一个名为JJTeachDB的数据库
on primary--在primary组中
(
name=JJTeachDB,--名字叫JJTeachDB
filename='e:\data\JJTeachDB.mdf',--文件名和路径
size=10MB,--初始大小
filegrowth=2MB--增长方式(此为每次MB)
)
log on--开始执行日志创建
(
name=JJTeachDB_log,--日志名称叫JJTeachDB_log
filename='e:\data\JJTeach...
为了美化页面,防止列表中字数过多。在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