Quantcast
Channel: Für Entwickler: SQL Server Forum
Viewing all articles
Browse latest Browse all 1772

Bild aus einem Binaer-Objekt zurück in eine JPG-Datei umwandeln/exportieren/auslesen.

$
0
0

Hallo,

auf einem MS SQL-Server 2008 R2 habe ich eine Tabelle "BilderVerwaltung", die für jeden Artikel ein Bild als Binärobjekt in der Datenbank gespeichert hat. Wie kann ich aus dieser Tabelle das Binärobjekt wieder als Bild in ein Verzeichnis exportieren.

Tabelle: "BildVerwaltung"

GUID (PS, uniqueidentifier, Nicht NULL)
ErstelltAm (datetime, NULL)
ErstelltDurch (nvarchar(50), NULL)
GeändertAm (datetime, NULL)
GeändertDurch (nvarchar(50), NULL)
DokumentFlag (bit, Nicht NULL)
BildFlag (bit, Nicht NULL)
Bemerkung (nvarchar(max), NULL)
ZeitStempel (timestamp, NULL)
Objekt (uniqueidentifier, Nicht NULL)
MenueFunktion (uniqueidentifier, NULL)
TabellenName (nvarchar(50), NULL)
DatenbankTyp (nvarchar(10), NULL)
Bild (varbinary(max), NULL)
AnzeigeIdentifizierer (nvarchar(100), NULL)
BildNummer (int, Nicht NULL)
LetzteBildÄnderung (datetime, nicht NULL)

Jetzt habe ich eine Format-Datei für BCP erstellt: bildformat.fmt

10.0

17

1      SQLCHAR            0       37     "\t"     1    GUID                                          ""

2      SQLCHAR            0       24     "\t"     2    ErstelltAm                                    ""

3      SQLCHAR            0       100    "\t"     3    ErstelltDurch                                 Latin1_General_CI_AS

4      SQLCHAR            0       24     "\t"     4    Ge„ndertAm                                     ""

5      SQLCHAR            0       100    "\t"     5    Ge„ndertDurch                                 Latin1_General_CI_AS

6      SQLCHAR            0       3      "\t"     6    DokumentFlag                                  ""

7      SQLCHAR            0       3      "\t"     7    BildFlag                                      ""

8      SQLCHAR            0       0      "\t"     8    Bemerkung                                     Latin1_General_CI_AS

9      SQLCHAR            0       17     "\t"     9    ZeitStempel                                   ""

10     SQLCHAR            0       37     "\t"     10   Objekt                                        ""

11     SQLCHAR            0       37     "\t"     11   MenueFunktion                                 ""

12     SQLCHAR            0       100    "\t"     12   TabellenName                                  Latin1_General_CI_AS

13     SQLCHAR            0       20     "\t"     13   DatenbankTyp                                  Latin1_General_CI_AS

14     SQLCHAR            0       0      "\t"     14   Bild                                          ""

15     SQLCHAR            0       200    "\t"     15   AnzeigeIdentifizierer                          Latin1_General_CI_AS

16     SQLCHAR            0       12     "\t"     16   BildNummer                                    ""

17     SQLCHAR            0       24     "\r\n"   17    LetzteBildŽnderung                            ""

 

Mit dem Befehl

bcp "Select [Bild] from [Firma].[ewa].[BildVerwaltung] where AnzeigeIdentifizierer = "70010250" and BildNummer = 1" queryout D:\Daten\Bilder\test70010250.jpg -S SERVER01\UNTERNEHMEN -U xx -P xxxxx -f D:\Daten\Bilder\bildformat.fmt

Leider funktioniert diese Befehl nicht.

Kann mir jemand helfen?


Viewing all articles
Browse latest Browse all 1772

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>