Try the following code to see if it works as expected:
CREATE TABLE childtable FREE (objectname C(20))
SELECT childtable
INSERT INTO childtable (objectname) VALUES ("specsupus.free")
INSERT INTO childtable (objectname) VALUES ("special.free")
INSERT INTO childtable (objectname) VALUES ("address1.free")
INSERT INTO childtable (objectname) VALUES ("disc.free")
select IIF("." $ objectname,SUBSTR(objectname,1,AT(".",objectname)-1), objectname) from childtable
You should get your expected output. If everything works fine then the problem is most likely that the objectname field is only 7 characters wide in the childtable. Before you run the select statement, put a breakpoint in the code and look at the contents of the childtable. See if you can add a field value larger than 7 characters.
>Has anybody encountered an error in using SUBSTR() with SELECT-SQL code?
>
>select IIF("." $ objectname, ;
> SUBSTR(objectname,1,AT(".",objectname)-1), objectname), ;
> from childtable
>
>This code returns only up to 7 characters. I noticed that if the objectname before the period is greater than 8 chars., it outputs only 7 characters. My examples are objectname="specsupus.free","special.free","address1.free","disc.free".
>
>The statement above returns
> specsup
> special
> address
> disc
>
>Is there any flag that affects this output that I should set to ON or OFF?
>
>Thanks a lot for th ehelp.
>
>Nerissa
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi