update Company set TFN=null where TFN='-2147483648'
update Application set CompanyTFN=null where CompanyTFN=-2147483648

UPDATE Company set TFN=null where CAST(TFN as int)<0
UPDATE Application set CompanyTFN=null WHERE CompanyTFN<0


select object_id from sys.columns where name like '%HIN%'
select * from sys.tables where object_id in (select object_id from sys.columns where name like '%HIN%')

 


/////////////////////////////////////////////////////////////////////////////////////////////////


drop table #Tmp
create table #TMP
(
ID int IDENTITY (1,1) not null, --创建列ID,并且每次新增一条记录就会加1
deptId int,
deptName varchar(50),
dataTimes datetime
primary key (ID) --定义ID为临时表#Tmp的主键
);

insert into #TMP Exec DEPTDisplay '果丹皮',5

select id,
(case deptId when '5' then 'HAHA'
when '4' then 'NoNo'
else 'Yeye'
end
) as Ids,
deptid,deptName,(select DATEADD(q,1,ISNULL(dataTimes,'1900-2-3'))) as tt from #TMP


declare @TempGroup table ( ID int,deptName varchar(50),dataTimes datetime)
insert into @TempGroup Exec DEPTDisplay '果丹皮',5
select id,
(case id when '5' then 'HAHA'
when '4' then 'NoNo'
else 'Yeye'
end
) as Ids,
id,deptName,(select DATEADD(q,1,ISNULL(dataTimes,'1900-2-3'))) from @TempGroup
union all
select id,
(case id when '5' then 'HAHA'
when '4' then 'NoNo'
else 'Yeye'
end
) as Ids,
id,deptName,(select DATEADD(q,1,ISNULL(dataTimes,'1900-2-3'))) from @TempGroup
select distinct * from @TempGroup

/////////////////////////////////////////////////////////////////////////////////////////////////

 

posted on 2016-08-14 21:52  xiaotank  阅读(303)  评论(0)    收藏  举报