Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Right Function in the where clause

Status
Not open for further replies.

murphyhg

Technical User
Mar 1, 2006
98
US
I want to exclude rows in a query which have this as the right 7 characters '[placex' This is what I tried to use.
AND (SELECT RIGHT(Articles.ByPassURL,7) <> '[placex')

What is the correct syntax? Thanks for your help.
 
Have you tried != instead of <>?



Thanks

John Fuhrman
faq329-6766
faq329-7301
thread329-1334328
thread329-1424438
 
This is what I have tried so far.

AND (SELECT RIGHT(Articles.ByPassURL,7)<> '[placex')
AND (SELECT RIGHT(Articles.ByPassURL,7)!= '[placex')

These are the error messages that I'm getting back.

Msg 102, Level 15, State 1, Line 13
Incorrect syntax near '<'.


Msg 102, Level 15, State 1, Line 13
Incorrect syntax near '!'.
 

Code:
AND       (SELECT RIGHT(Articles.ByPassURL,7)<> '[placex')
AND         (SELECT RIGHT(Articles.ByPassURL,7)!= '[placex')

Just a guess.

but.

Code:
Select [columns]
from URLtraffic
where RIGHT(Articles.ByPassURL,7) != '[placex')

In a statement as such you shouldn't need the select.

Is that what your trying to do?








Thanks

John Fuhrman
faq329-6766
faq329-7301
thread329-1334328
thread329-1424438
 
The correct suntax is to use RIGHT() function directly :) not in Sub select (as sparkbyte showed it)

But I just don't get it from where sparkbyte get the names of the tables :)
Maybe the example should be:
Code:
Select [columns]
       from Articles
where RIGHT(Articles.ByPassURL,7) <> '[placex'
--- I prefer [<>] to [!=] because it is most visible by me :-)



Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
OOPS, punctuation problem:
The correct suntax is to use RIGHT() function directly smile not in Sub select (as sparkbyte showed it)

should be

The correct syntax is to use RIGHT() function directly (as sparkbyte showed it) not in Sub select :)


Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
Sorry, wasn't paying attention to the Articles.ByPassURL as table and column.

Was just trying to show example.

Thank you for clarifying Borislav.

Thanks

John Fuhrman
faq329-6766
faq329-7301
thread329-1334328
thread329-1424438
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top