Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to return .T. of .F. from SQL server?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01568922
Message ID:
01568923
Vues:
78
This message has been marked as the solution to the initial question of the thread.
>Hi,
>
>I want to execute an IF expression against a SQL Server using SQLEXEC() and return some "meaningful" result that will tell me if IF was True or False. For example: Here is the IF expression:
>
>
>cExpr4Sql = "IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.Columns WHERE Table_Name = 'MyTable' 
>AND COLUMN_NAME = 'MyField1' AND CHARACTER_MAXIMUM_LENGTH = 50 )"
>
>
>When executing the above expression in SSMS it tells me if the column MyField1 has a length of 50 char or not.
>
>If I pass the above expression to SQLEXEC() how do I return the result? E.g.
>
>
>xReturn = SQLEXEC( nConn, cExpr4Sql )
>
>
>TIA for any suggestions.
TEXT TO cExpr4Sql NOSHOW
     IF EXISTS(SELECT *
                      FROM INFORMATION_SCHEMA.Columns WHERE Table_Name = 'MyTable'
                                                        AND COLUMN_NAME = 'MyField1'
                                                        AND CHARACTER_MAXIMUM_LENGTH = 50 )
       SELECT CAST(1 AS bit) AS FieldExists
     ELSE
       SELECT CAST(0 AS bit) AS FieldExists
ENDTEXT

xReturn = SQLEXEC( nConn, cExpr4Sql, "cCursor" )
WAIT WINDOW cCursor.FieldExists
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform