April 4, 2008 at 7:26 am
All,
Im using the following statement to upload a file into a database. And this works ok.
Im wondering how can i re-create the file from the data stored in the database. I would
appreciate any help with this.
Regards niall
INSERT INTO test (Site_Code,
File_Name,
File_Path,
File_Rows,
Create_Date,
File_Data)
SELECT "00051" AS [Site_Code],
"test.zip" AS [ODB_File_Name],
"c:\test.zip" AS [ODB_File_Path],
50 AS [ODB_File_Rows],
GETDATE() AS [Create_Date],
* FROM OPENROWSET(BULK "c:\test.zip" , SINGLE_BLOB) AS [ODB_File_Data]
April 4, 2008 at 11:00 am
I haven't tried it, but I believe openrowset can write to files as well as read from them. You might try that.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
April 4, 2008 at 11:52 am
The actual file is stored in the database as what type of column? VARBINARY? I belive you can use BCP to output a file.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply