日期:2014-05-17 浏览次数:20771 次
if object_id('[TB]') is not null drop table [TB]
go
create table [TB] (id int,测点1 int,测点2 int,测点3 int,测点4 int,测点5 int,时间 datetime)
insert into [TB]
select 1,103,204,101,201,101,'2013-8-8 10:0:0'
select * from [TB]
SELECT CASE WHEN LEN(CONVERT(VARCHAR, 测点1) + CONVERT(VARCHAR, 测点2)
+ CONVERT(VARCHAR, 测点3) + CONVERT(VARCHAR, 测点4)
+ CONVERT(VARCHAR, 测点5)) - LEN(REPLACE(CONVERT(VARCHAR, 测点1)
+ CONVERT(VARCHAR, 测点2)
+ CONVERT(VARCHAR, 测点3)