| Author |
Topic |
|
under2811
Constraint Violating Yak Guru
366 Posts |
Posted - 2006-02-15 : 16:30:41
|
| hican anybody please help me out in... how i will store image in database table???T.I.APapillon |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-02-15 : 16:32:42
|
| First, it isn't recommended. In fact, it's highly not recommended. You should store the image on disk and just the path and file name in the database. Second, if you really want to do this, then you'll need a front-end application to do it as you can't do it via T-SQL, well that is receive an image and insert it purely through T-SQL. Your application will have to give th binary bits of the image to the insert statement.Tara Kizeraka tduggan |
 |
|
|
under2811
Constraint Violating Yak Guru
366 Posts |
Posted - 2006-02-15 : 16:35:45
|
| Hi Tara...can u please give me e.g. for "You should store the image on disk and just the path and file name in the database".T.I.APapillon |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-02-15 : 16:39:41
|
| INSERT INTO YourTable(PKColumn, PathFileName)VALUES(1, 'E:\images\FileNameGoesHere.jpg')So your application would save the file to disk (but not on the database server, it should be on your own app/web server). Your application would store the path and file name in the database like above. I'd actually not store the drive letter in the database though in case you ever want to move things around. I'd put that value in a config file. Then concatenate that value with the rest stored in the database to get the whole path and file name.Tara Kizeraka tduggan |
 |
|
|
under2811
Constraint Violating Yak Guru
366 Posts |
Posted - 2006-02-15 : 16:41:07
|
| just tell me which data type u used here for 2nd column?thanks a lot tara!!!!!!!papillon |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-02-15 : 16:44:29
|
| Ummm, varchar or nvarchar of course. Make the size big enough to fit the largest path and file name, but not too big that you surpass the table size limit. I believe SQL Server stores paths in sysname data type, which is nvarchar(256).Tara Kizeraka tduggan |
 |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2006-02-16 : 02:30:28
|
| make sure you check the links afrika posted. -ec |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2006-02-16 : 05:58:26
|
| http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=ImageKristen |
 |
|
|
|