Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Len of Data in col

Author  Topic 

juliemac
Starting Member

12 Posts

Posted - 2011-10-14 : 09:23:46
I have a column of data in an Excel spreadsheet. One Col, called Dept has a 4 digit name EG: A123. Also in that col is a total EG A123 Total.

I want the SQL to only include data where the len is equal to 4, not greater.

Thanks!

Grifter
Constraint Violating Yak Guru

274 Posts

Posted - 2011-10-14 : 09:53:15
How are you using SQL in excel, are you doing VBA with SQL statement or something?

If you want to show data from a column where it is only 4 chars in length then:

select yourdata
from yourtable
where len(yourdata) = 4


G
Go to Top of Page

juliemac
Starting Member

12 Posts

Posted - 2011-10-14 : 10:32:52
Perfect! Many thanks!
Go to Top of Page
   

- Advertisement -