Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to delimit a GUID in a SQLEXEC statement
Message
 
 
À
05/05/2004 19:25:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00901407
Message ID:
00901413
Vues:
13
Hi Margaret,

First, you should check SQLEXEC() return value and in the case of error use AERROR() function to get detailed info about ODBC error. For example
...
TEXT TO lcSQL TEXTMERGE NOSHOW PRETEXT 7
SELECT dlID2, dlID1, dlLTID, 2, 0 AS Processed  
FROM DataLink 
WHERE  dlID1 = 'BE63E413-CD51-4D89-8D17-AF79829Fxxxx'
ENDTEXT
lnRet = SQLEXEC(hConn, lcSQL )
IF lnRet = -1
  AERROR(...)
  * Process ODBC error
ENDIF
You get the error because you pass invalid uniqueidentifier (GUID). It should be 36 characters long (including dashes) and yours is 4 characters short.


>I use SQL GUID's as keys on my SQL tables. I am getting the GUID for a record and going to look for other records in a different table with that GUID. My statement is
>
>
>SELECT dlID2, dlID1, dlLTID, 2, 0 AS Processed  FROM DataLink 
WHERE  dlID1 = 'BE63E413-CD51-4D89-8D17-AF79829F'
>
>
>No matter what character I use for delimiters, I can't seem to build the statement for the VFP SQLEXEC so it works. I tried the statement on the SQL Query Analyzer and the error I get is
>
>
>Server: Msg 8169, Level 16, State 2, Line 6
>Syntax error converting from a character string to uniqueidentifier.
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform