April 23, 2008 at 11:55 am
hi guys, can someone tell me how can i query a query to give me the rows in which the lenght is bigger than 8?
April 23, 2008 at 12:16 pm
select (column list)
from dbo.Table
where len(column) > 8
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
April 23, 2008 at 12:21 pm
Be aware that LEN does not count trailing spaces.
SELECT LEN('abc') -- 3
SELECT LEN('abc ') -- 3
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 23, 2008 at 1:03 pm
thank you!! exactly what i need, just to confirm my column is nvarchar(8), then i could use your code to see which rows will not truncated if i use the import wizard (from another sql table), correct?
April 23, 2008 at 1:08 pm
Yup. Should be fine.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 23, 2008 at 1:12 pm
thank you!!!!:D
April 23, 2008 at 1:38 pm
sorry, another question, how do i get the first 8 characters?
April 23, 2008 at 1:43 pm
SELECT LEFT(<Some Column>,8) FROM ....
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 23, 2008 at 1:57 pm
thank youuuuuuuu!!!!
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply