Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Linked server syntax fun
Message
 
À
10/12/2008 14:04:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01366470
Message ID:
01366512
Vues:
10
>It won't work. You cannt have a var inside of a pass-through query.
>
>>>That what openquery is for. You can send pass-through query to the specified linked server. Fox is in my case.
>>>Problem is to build a complete string with parameters. Too many quotes.
>>
>>If the linked server is Fox and you want to use strings do this:
>>
>>
>>select * from openquery(VAMCPD,'select a.cItemno,a.nShipQty,a.nSalesAmt-a.nDiscAmt as Amt
>>                                       from aritrs a
>>                                inner join arinvc b on a.cInvNo=b.cInvNo
>>                                where a.cCustno+a.cInvNo like "'+@StringPar+'%" and cType= ""')
>>
>>this is not tested.
>>As you see you can use double quotes ub the query string if the linked server accepts them.
>>
>>You even can use square brackets:
>>
>>select * from openquery(VAMCPD,'select a.cItemno,a.nShipQty,a.nSalesAmt-a.nDiscAmt as Amt
>>                                       from aritrs a
>>                                inner join arinvc b on a.cInvNo=b.cInvNo
>>                                where a.cCustno+a.cInvNo like ['+@StringPar+'%] and cType= []')
>>
Then how about:
(not tested again :-))
select * from openquery(VAMCPD,'select a.cItemno,a.nShipQty,a.nSalesAmt-a.nDiscAmt as Amt
                                       from aritrs a
                                inner join arinvc b on a.cInvNo=b.cInvNo
                                WHERE cType= []') test
where test.cCustno+test.cInvNo like @StringPar+'%'
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
Répondre
Fil
Voir

Click here to load this message in the networking platform