Nourless
Nourless

Reputation: 854

How should I insert video in SQL Server with column of description?

I have tables with two columns: Video and desc. I want to insert video in SQL Table. I use next script:

INSERT INTO table(Video)
 SELECT ( SELECT BulkColumn FROM OPENROWSET(BULK 'source\video.mp4', SINGLE_BLOB) AS x)

but I want also insert some description, so I imagine it like

INSERT INTO table(Video, desc)
 (SELECT ( SELECT BulkColumn FROM OPENROWSET(BULK 'source\video.mp4', SINGLE_BLOB) AS x) , some_description)

How should I implement it?

UPD What if description is the .txt file? What should I do in this case?

Upvotes: 0

Views: 579

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269973

Why are you nesting the select?

INSERT INTO table (Video, description)
    SELECT BulkColumn, 'my description here'
    FROM OPENROWSET(BULK 'source\video.mp4', SINGLE_BLOB) as x

Upvotes: 2

Related Questions