Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Import SQL Server query into a DBF
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01672529
Message ID:
01672545
Vues:
52
>>>>Hi,
>>>>
>>>>When you run a SQL Select in SSMS and see the query, you can Select All and Copy with Header or Without Headers.
>>>>But then, if you paste this "report" into a Word or Notepad, you can't really see the records easily.
>>>>
>>>>Has anybody created a code that would import this copy of the SQL Server query into a DBF?
>>>>
>>>>TIA
>>>
>>>That's easy enough. Just make a variable which holds the very same query. Then when you SQLExec() this query, you end up with a DBF which you can Copy to a DBF.
>>
>>The problem is that I am running this query in the SSMS (remotely connected to the custom site). So, I cannot use VFP SQLExec(). But I can run the SQL Select and copy the query.
>>Thank you.
>
>Hi Dmitry,
>
>
>lcData=_cliptext && get data clipboard
>lii=AT(CHR(13), lcData)
>lcHeader=LEFT(lcData, lii) && get header - column list
>lcData=SUBSTR(lcData, lii+1) && data
>liColumns=OCCURS(CHR(9),lcHeader)+1 && column count
>?liColumns
>lilines=ALINES(xxa, lcData,0,CHR(9),CHR(13)) && convert string to array 1-dim
>DIMENSION xxa(lilines/liColumns,liColumns) && redimension to 2-dim array
>SET DATE YMD && date/date time is in XML format/121
>APPEND FROM ARRAY xxa && cursor/tablr must exists with right structure
>SET DATE german
>BROWSE
>
>
>MartinaJ

Thank you, Martina. I am having a little problem with your code. But it is probably me not your code.
UPDATE. I found what I was missing in your code. I have to create the cursor first. Again, thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform