PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.db.ms-sqlserver > BCP out image files not working
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
BCP out image files not working

Réponse
 
LinkBack Outils de la discussion
Vieux 10/10/2008, 02h08   #1
fraser.jc@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut BCP out image files not working

We have a table in our SQL2005 db with a varbinary(max) column in it.
In this field we store images and pdfs that the user has uploaded in
our .net 2.0 web app. I'm attempting to get the images out via sql
using the bcp utility (-n option for preserving native format).

The bcp command is not failing.
The image file is being created correctly (filename and file size are
intact).
Opening the image results in a "Preview not available" message.
BCP'ing out the PDFs in the exact same fashion works a treat.

Any ideas how to bcp out images? Or alternatives to bcp?

Thanks!!
Jon
  Réponse avec citation
Vieux 10/10/2008, 03h00   #2
fraser.jc@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: BCP out image files not working

I found out that in the bcp process, an extra 8 junk hex characters
are added to the start of the file. Take them out and the image is
perfect once more
  Réponse avec citation
Vieux 10/10/2008, 23h33   #3
Erland Sommarskog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: BCP out image files not working

(fraser.jc@gmail.com) writes:
> I found out that in the bcp process, an extra 8 junk hex characters
> are added to the start of the file. Take them out and the image is
> perfect once more


Those are not junk characters. That is the length of the data.

To achieve what you want, use this format file:

9.0
1
1 SQLBINARY 0 0 "" 1 col ""



--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h17.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08868 seconds with 11 queries