Using OPENROWSET and BCP

  • Can I insert any files into a blob varbinary and then use bcp to export the file..

    I have experimented a bit with this:

    CREATE TABLE data(data varbinary(max));

    INSERT INTO data(data)

    SELECT * FROM

    OPENROWSET(BULK 'c:\test\highres.wmv', SINGLE_BLOB) as f;

    declare @cmd varchar(512);

    SET @cmd =

    'bcp "SELECT data FROM test.dbo.data" queryout c:\test\001.wmv -T -N -S servername';

    EXEC xp_cmdshell @cmd;

    The problem is, that the file is corrupted and cannot be viewed after bcp..

    Please help

  • Have you tried using the "-n" parameter instead of the "-N" one?

  • Now I have.. But unfortunately without success.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply