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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help Shortening WHERE Clause Currently over 255 Characters

Status
Not open for further replies.

dreamaz

Technical User
Dec 18, 2002
184
CA
Hi

I posted this in the MS SQL forum but just found out we are using Sybase 12.5.

Problem is, my current select statement exceeds 255 characters...and only the first 255 are being considered thus making the statement useless. Any suggestions?

select record_id from editorial_sub8 where a1 like'%|He%' or a1 like'%|Ent B%' or a1 like'%|Fin B%' or a1 like'%|Music B%' or a1 like'%|News B%' or a1 like'%|Sports B%' or a1 like'%|Travel B%' or a1 like'%|Weather B%' or a1 like'%|Welcome B%'

Thanks folks

 
Sorry folks,

jsut did a char-count and that adds up to 242... so i'm assuming it's already truncated.. nevertheless, any suggestions on how to shorten the statement and still include all the clauses?

 
Hi,

Why not use the UNION clause to split your query into two or more select statements.

e.g.

select record_id from editorial_sub8 where a1 like'%|He%' or a1 like'%|Ent B%' or a1 like'%|Fin B%' or a1 like'%|Music B%' or a1 like'%|News B%'

union all

select record_id from editorial_sub8 where a1 like'%|Sports B%' or a1 like'%|Travel B%' or a1 like'%|Weather B%' or a1 like'%|Welcome B%';

hopes this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top