adding files into SQL 2005

SlickRoenick

Member
Jul 13, 2005
36
0
0
Turns out it isn't as easy as i thought it would be. I'm comfortable enough adding data to tables (age, height, weight, favorite color, salary, etc), but adding actual files to tables has not been something i've done before. I assume i have to get an INSERT statement to take a file (.jpg, .pdf, .doc, etc) and put it into a column with datatype either IMAGE or some kind of binary. But i'm quite lost, any ideas?
 

mAdMaLuDaWg

Platinum Member
Feb 15, 2003
2,437
1
0
I'd totally advise against this because it really isn't efficient. You are far better off storing the file in a directory and storing the link in the database. That being said you can use an IMAGE type to store files. You would have to open the file using a filestream and write the binary data to a column. Dunno which language you are using so just do a google for BLOB SQL Serrver