09-23-2008 10:33 AM
Hi all,
I want to get a part in the field of table to compare with a string. But the LIKE syntax is poor efficiency. Who can give another way. thx in advance.
Eg:
SELECT *
FROM TAB1
INTO IT_TAB1
WHERE FIELD1 = '2008'.
But in the FIELD1 is '2008AAAA', I want to compare '2008' with the frontal 4 char.
09-23-2008 10:34 AM
09-23-2008 10:35 AM
Hi Steven,
SELECT *
FROM TAB1
INTO IT_TAB1
WHERE FIELD1+0(4) = '2008'.
Hope this helps you.
Regards,
Kiran
09-23-2008 10:36 AM
Hi,
Try like this....
SELECT * INTO TABLE IT_TAB1 FROM TAB1 WHERE FIELD1(4) = '2008'.
Hope it will helps
09-23-2008 10:39 AM
fine.
Move first 4 characters to a variable and use it in where condition.
eg: concatenate field1(4) into field2.
use field2 in select stmt.
It increases performance also.
regards,
Padmashree.
Edited by: Padmashree RamMaghenthar on Sep 23, 2008 3:10 PM
09-23-2008 10:41 AM
HI,
Try out this.
data : var(4) type c value '2008'.
SELECT *
FROM TAB1
INTO IT_TAB1
WHERE FIELD1 like var%.
Thanks.
Swati.
09-23-2008 10:48 AM
First check in database based on '2008' are you getting records or not, if yes then you have to use mentioned logic
FIELD1 = FIELD1+0(4).
and FIELD1 to select statement.
Rajneesh Gupta