[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Substring within where clause



Sorry, but.... does anyone read  the question?

(cut some pieces)

> I need to select a field from a table based on a substring of a field
> within that table.  I tried the following (and other variations), ...

> WHERE substr(&A.DESCR,1,15) = $H_Academic_Term

> (I also tried it without the & before A.DESCR and got errors...)

What I thought of right away is, and wondered why no-one else thought
of this is: what database are you on? If it would be Sybase (or MS-SQL)
it would never work because substr is a sqr function where substring is
the sybase function. Then it would be

> WHERE substring(A.DESCR,1,15) = $H_Academic_Term

So I guess using A.DESCR in the select clause may be considered a
work-around (you initialise the variable &A.DESCR which makes it
possible for an sqr function), but does it work always as you expect?

Just my thoughts....
Arjan

PS I would like to advice everyone to at least give the db-server you
wourk on when asking a question... e.g. sybase, oracle, ms-sql, db2...




__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/