Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inserting BLOB data
Message
 
À
14/10/2011 18:47:44
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01526493
Message ID:
01526524
Vues:
38
DECLARE @lcSQL NVARCHAR(MAX), @lcFileName NVARCHAR(MAX), @lcFile NVARCHAR(MAX)

SET @lcFileName=N'tricycle_pink.gif'
SET @lcFile='c:\images\tricycle.jpg'

SET @lcSQL=N'
INSERT Production.ProductPhoto (   ThumbnailPhoto,    ThumbnailPhotoFilePath,    LargePhoto,    LargePhotoFilePath)
 SELECT ThumbnailPhoto.*, null, null, @lcFILENAME
   FROM OPENROWSET 
     (BULK ''' +@lcFile+  ''', SINGLE_BLOB) ThumbnailPhoto'

EXEC sp_executesql @lcSQL, N'@lcFILENAME NVARCHAR(MAX)',@lcFILENAME
MartinaJ

>I found this code and I've tried this before on my setup and I got it to work in a test environment.
>
>Now, the project is moving forward.
>
>However, it occurred to me that on my test setup, the C: drive of the SQL Server and the C: drive of where the file resides are the same.
>
>That will not be true in the production world.
>The file will be on the C: drive of the client W/S.
>Is that an issue or am I conjuring up non-existing issues (again)?
>
>If is an issue, how to handle it?
>
>
>
>INSERT Production.ProductPhoto (
>    ThumbnailPhoto, 
>    ThumbnailPhotoFilePath, 
>    LargePhoto, 
>    LargePhotoFilePath)
>SELECT ThumbnailPhoto.*, null, null, N'tricycle_pink.gif'
>FROM OPENROWSET 
>    (BULK 'c:\images\tricycle.jpg', SINGLE_BLOB) ThumbnailPhoto
>
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform