>>>>>>OK Here's my solution. Thanks to all of you who contributed.
>>>>>>Borislav - I don't see the need for your form of ?m.lcPermID since lcPermID is a local variable and the select is called only once. Perhaps I am missing something.
>>>>>>
>>>>>>lcSQL = "select * " + ;
>>>>>> "from TRPSurvey" + "..exported " + ;
>>>>>> "where ltrim(rtrim(PermID)) = " + lcPermID
>>>>>>
>>>>>>IF sqlexec(m.lnHandle,lcSQL,"crsImport") < 0
>>>>>> AERROR(laError)
>>>>>> MessageBox(laError[1,2])
>>>>>>ENDIF
>>>>>>
>>>>>
>>>>>How does it work? I do not see lcPermID surrounded by single quote.
>>>>
>>>>What about ltrim(rtrim construction? If I would be a sql-server programmer (on primary basis, i mean) then i could kill someone.
>>>
>>>:-)
>>>Agree, but I think that comes from our front end - VFP.
>>>Till VFP9 there was no varchar types and when you design SQL Server database you design it as you used to in VFP - CHAR, Numeric, Date (OOOOPS no Date type, what I must do now?????) etc.
>>
>>Still we are responsible for database design. It means integer (or at least fixed-length char) primary/foreign keys.
>
>Yes, if WE designed it. I always want to have INTEGERS as PK and whan I design DB that is what I have, but sometimes you are stick with someone DB and you must do extraordinary work to get what you want.
>Par example. I fight with a Canadian system WHICH HAVE 3 different DataBases plus ONE RESULTING DataBase. 4 DataBases for ONE system is toooooooooooooooo much. And that system is for Access control!!!!!!!!! I don't want to speak about the Database design at all.
I feel your pain.
Edward Pikman
Independent Consultant