请问一下我想查询列中哪些是7位,哪些是8位的数据,表达式应该怎么写,请指点,谢谢!!例如:A列
13556531
32155163
6135655
61313554
5513587
3213588查询后:A列
13556531
32155163
61313554
A列
6135655
5513587
3213588
13556531
32155163
6135655
61313554
5513587
3213588查询后:A列
13556531
32155163
61313554
A列
6135655
5513587
3213588
select * from t where len(A列)=8
where len(A列)=7
UNION ALL
select A列 A列 from tableName where len(ltrim(rtrim(A列)))=8
declare @t table (id int, name nvarchar(50))
insert into @t select 1,'fsda'
insert into @t select 2,'fd'
select name,len(name) as 'length' from @t