Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BCP from Foxpro
Message
De
12/01/2008 17:43:17
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
12/01/2008 13:46:03
Suhas Hegde
Dental Surgeon
Sirsi, Inde
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:
01281377
Vues:
10
>hi,
>
>Sql server 2005 express
>
>I can upload the image and want to copy it out from Sql server
>This works and a file is created. But the problem is that the BCp prefixes 4 bytes(Dword) the size of the file in BYtes. Hence the File is not readable format.
>
>How can i tell the BCP utility not to prefix the Dword value
>
>
>CLOSE tables
>clear
>m.fstr = conver_to_hex(FILETOSTR(GETFILE()))
>m.pstr = putfile()
>
>han = SQLCONNECT('A') && valid Sql connection
>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 "]+m.pstr+[" -T -N  -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
>
>
>
>
>Thanx in Advance
>
>Suhashegde

Suhas,
Do you need bcp for it? Check if this helps:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=182900&SiteID=1

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform