Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unexplained value in SQL field
Message
From
09/10/2006 12:45:33
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01160578
Message ID:
01160609
Views:
8
>>>NVL() is shorter but neither one will work for SQL Server because it doesn't have IIF() and VFP NVL() is ISNULL() on SQL Server.
>>
>>Would there be any consideration in adjusthing the SQL so I could have something workable if I change the backend without having to change the code?
>>
>>Usually, I do have some method that I call from the data class when I build the SQL command. So, I have one method that does the proper terminology on condition such as:
>>
>>
>>        If Not loDataProvider.SQLUpdate("UPDATE Member SET LastHit=?,SessionID=? " + _
>>         "WHERE Member.Numero="+loDataProvider.ParameterAddSQL("Numero"), oProcess.oApp.aConnection(1)) Then
>>            cHtml = oProcess.cError
>>            Return False
>>        End If
>>
>>
>>That is from VB.NET when using the VFPOleDb provider.
>>
>>I also have another method when I need to have a condition based on a logical field which is a different syntax in SQL Server. I guess I could build another method which would generate the proper syntax when in need of the NVL() approach.
>
>I don't think there's a code that will work for both. In SQL Server it'll be
>ISNULL(Member.NoSchool,0) AS ...
>
You don't have to worry about result column size because SQL Server will determine it correctly.

this is not true with ISNULL(), uses COALESCE()
Previous
Reply
Map
View

Click here to load this message in the networking platform