Welcome to WindowsClient.net | Sign in | Join

Zuker On Foundations

The realm of .NET (WPF, WCF and all around)

Sponsors





  • advertise here

SQL 2005 - Save File into Image/VarBinary columns

Via this post.

I created a column in a certain table to contain various files with "VarBinary(MAX)" as its data type.

I wanted to test stuff, so I needed data in the tables.

But Oh My, Now What? Should I really write C# Project to insert a file?

Well, no, not needed, you can do it directly from SQL.

Create Table EmployeeProfile
(
EmpId int,
EmpName varchar(50) not null,
EmpPhoto varbinary(max) not null
)
Go 

Insert EmployeeProfile (EmpId, EmpName, EmpPhoto)
Select 1001, 'Vadivel',
BulkColumn from Openrowset( Bulk 'C:\Blue Lace 16.bmp', Single_Blob) as EmployeePicture

Posted: Sep 03 2008, 03:43 PM by zuker | with no comments
Filed under:

Comments

No Comments

Leave a Comment

(required) 

(required) 

(optional)

(required) 

Page view counter