Return field if LENGTH equal 8

How do I return a field only if its length equals to 8. I have a field called part number and I only want the data that has 8 characters in that field.

what if field has trailing or leading empty spaces?
notice 7th and 11th return.

create table #sonyc(id int not null, partnumber varchar(50))

insert into #sonyc
select 1, '1' union
select 2, '12' union
select 3, '123' union
select 4, '1234' union
select 5, '123456' union
select 6, '1234567' union
select 7, '12345678' union
select 8, '123456789' union
select 9, '1234567890' union
select 10, '12345678901' union
select 11, ' 1234567' union
select 12, '123456789  ' 

select * 
From  #sonyc
where len(partnumber) = 8

drop table #sonyc

No I don't want to return trailing or leading empty spaces

then you can try this

select * 
From  #sonyc
where len(rtrim(ltrim(partnumber))) = 8

I'm trying to accomplish this through Cognos. I get an error when I use this

I was able to use this with no errors:
[Part Number] =RIGHT('000000000'||[Part Number],8)

How would I include my LEFT trim in this query?

this is Microsoft SQL server forum not Cognos.

That's fine. More importantly, I got it figured out.