Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BCP from Foxpro
Message
De
13/01/2008 20:32:58
Suhas Hegde
Dental Surgeon
Sirsi, Inde
 
 
À
12/01/2008 17:43:17
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Database:
MS SQL Server
Divers
Thread ID:
01281359
Message ID:
01281514
Vues:
12
CLOSE tables
clear
m.fstr = conver_to_hex(FILETOSTR(GETFILE()))
m.pstr = putfile()
han = SQLCONNECT('A')
m.lcsql = [CREATE TABLE ##foo1 (f1 Varbinary(max) )]
SQLEXEC(han,m.lcsql)

lcsql = [insert into ##foo1 (f1) values ( ]+m.fstr+[)]
SQLEXEC(han,lcsql)
	lcsql = [DECLARE @SQLcommand varchar(1000) ]+;
	[set @SQLcommand = 'bcp "SELECT f1 FROM ##foo1 " queryout "]+pstr+[" -f"c:\test\image.fmt" -T  -SNAGAVENI\SQLEXPRESS ' ]+;
	[exec xp_cmdshell @SQLcommand]
SQLEXEC(han,lcsql)  

SQLDISCONNECT(han)

procedure conver_to_hex
LPARAMETERS tcstring
LOCAL lcstring
lcstring = '0x'
FOR m.xi = 1 TO LEN(tcstring)
lcstring = lcstring + strtran(TRANSFORM(ASC(SUBSTR(tcstring,m.xi,1)) ,'@0'),'0x000000','')
endfor
RETURN lcstring
And a image.fmt is

9.0
1
1 SQLBINARY 0 0 "" 1 f1 ""


Please Note it is tabs in between like

1 tab SQLBINARY tab 0 tab 0 tab "" tab 1 tab f1 tab ""


I had spaces and that kinda put me off for a very very long time.

Suhashegde
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform