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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Skip row..

Author  Topic 

TazMania
Yak Posting Veteran

63 Posts

Posted - 2006-11-28 : 07:57:57
Hi,

I'm trying to make a select where if a columns length is more that 3 it should skip that row, anyone of you who can help in completing this query ?

My code failes at <=


SELECT DataLength(AdhocITSQL7.dbo.Medarbejder.Initialer) AS LengthOfInitialer,AdhocITSQL7.dbo.Medarbejder.Navn,
AdhocITSQL7.dbo.Medarbejder.Afdeling,AdhocITSQL7.dbo.Medarbejder.Telefon,AdhocITSQL7.dbo.Medarbejder.Mobiltelefon,
AdhocITSQL7.dbo.Medarbejder.Lokation,
CASE LengthOfInitialer
WHEN LengthOfInitialer <= 3 THEN AdhocITSQL7.dbo.Medarbejder.Initialer LIKE '%tes%' END
FROM Medarbejder
ORDER BY AdhocITSQL7.dbo.Medarbejder.Lokation ASC,AdhocITSQL7.dbo.Medarbejder.Navn ASC


Best regards
Taz

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-11-28 : 08:04:03
[code]
SELECT t1.Medarbejder.Navn, t1.Afdeling, t1.Telefon, t1.Mobiltelefon, t1.Lokation
FROM Medarbejder t1
where DataLength(t1.Initialer) <= 3
ORDER BY t1.Lokation, t1.Navn
[/code]



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-28 : 08:05:24
For a fellow scandinavian
It is not clear what the CASE and LIKE codeline is doing.
SELECT		Navn,
Afdeling,
Telefon,
Mobiltelefon,
Lokation
FROM AdhocITSQL7.dbo.Medarbejder
WHERE DATALENGTH(Initialer) <= 3
OR Initialer LIKE '%tes%'
ORDER BY Lokation,
Navn

Peter Larsson
Helsingborg, Sweden
Go to Top of Page

TazMania
Yak Posting Veteran

63 Posts

Posted - 2006-11-28 : 08:28:37
Thx guys :)



Best regards
Taz
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-28 : 08:30:47
Replace DATALENGTH with LEN, if you don't allow three spaces as Initial.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -