随笔分类 - Sqlserver
摘要:正在还原解决方法:restoredatabaseTest2withrecovery
阅读全文
摘要:代码一:将Name中的字符COPY至Comment中Option Explicit ValidationMode = True InteractiveMode = im_BatchDim mdl ' the current model' get the current active model Se...
阅读全文
摘要:WITH (NOLOCK)缺点: 1.会产生脏读 2.只适用与select查询语句优点: 1.有些文件说,加了WITH (NOLOCK)的SQL查询效率可以增加33%。 2.可以用于inner join 语句
阅读全文
摘要:select t2.*,ch from (select vinnumber,max(channelid) ch from t_jeff group by VINNumber) t1, t_jeff t2 where t1.VINNumber = t2.VINNumber order by ch...
阅读全文
摘要:初始化主表数据declare @i int set @i=2010 while @i<2030 begin insert into OA_Merchants_SaleStatusMain ([Year]) values(@i) set @i=@i+1 end 初始化从表drop table #tem...
阅读全文
摘要:create table Sequence_OA_Merchants_EnterpriseBasic( -- ID列为自增列 SeqID int identity(1,1) primary key, -- Sequence值 SeqVal varchar(1)...
阅读全文
摘要:select REPLICATE(0,5); 五个零
阅读全文
摘要:注意表设计允许null属性,空数据录入失败,而且有时错误在程序中抛不出,很难查找错误
阅读全文
摘要:1 select a.name 表名,b.name 列名 from sysobjects a,syscolumns b 2 where a.id=b.id and b.name='SortCode' and a.type='U'
阅读全文
摘要:行转列,列转行,传统方式与pivot方式,不同的实现,同样的结果最近在做考勤管理,有需要行转列的报表,CaseWhen老方法可以实现,但Pivot方法实现更为简便,以下是具体实现。 1 --行转列 2 create table T_1(Name varchar(10),LeaveType varch...
阅读全文

浙公网安备 33010602011771号