I am traveling to Toronto from Microsoft MVP Sumeet. I will be very tired as I am continuously working very hard from last 27th Feb. I am still Jet Legged from my trip from India to USA and now I am again changing time zones by visiting Canada. I get all my energy from feeling that what I am doing is helping community and I am working hard to help people who are looking for help.
Interestingly Steven Biggins, a reader of this blog was with me in same flight to Canada. He recognized me and asked me following question. As I have never done this before I had to pull out my laptop in flight and start writing code. Following T-SQL script demonstrates the code which inserts the image in database. You will need small image on your hard drive to create this example. You can download Image and T-SQL Code.
USE [AdventureWorks]
GO
--Create Table
CREATEÂ TABLE [dbo].[ImageTest](
[ID]Â [int] IDENTITY(1,1)Â NOTÂ NULL,
[Image]Â [varbinary](MAX)Â NULL
) ON [PRIMARY]
GO
--Insert Image
INSERTÂ INTO [dbo].[ImageTest]([Image])
SELECT * FROM
OPENROWSET(BULK N'C:\ImageCode\sa.jpg', SINGLE_BLOB) AS Document
GO
--Clean Up DB
DROPÂ TABLE [dbo].[ImageTest]
GO
Now my question to reader is how to retrieve the image and create JPG file again. I will post the solution soon but I rather prefer that the solution provided by my reader.
Following is my travel itinerary so far:
Feb 27, 2009 – Departing Ahmedabad to Mumbai
Feb 28, 2009 – Departing Mumbai to Seattle Sheraton Hotel
March 1, 2009 – Day 1 at MVP Summit
March 2, 2009 – Day 2 at MVP Summit
March 3, 2009 – Day 3 at MVP Summit
March 4, 2009 – Day 4 at MVP Summit
March 5, 2009 – Departing Seattle to Toronto
March 6, 2009 – Tech User Group Meeting, Markham, Canada
March 7, 2009 – Departing Toronto to Mumbai
March 8, 2009 – Missing Day due to Day Line Crossing
March 9, 2009 – Arriving to Ahmedabad
Reference : Pinal Dave (https://darkslategrey-bat-805937.hostingersite.com)