Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Getting an image from another stored proc

Author  Topic 

toddhd
Yak Posting Veteran

55 Posts

Posted - 2008-09-22 : 16:45:05
Here is my problem - we have images stored in the database which need to appear on *.rdl reports. Which image goes on which report is a complicated process, so there is a sproc in place to handle that. It takes in one ID (int) param and returns an image (a logo). For what it is worth, there is no 1-to-1 correlation which would make for an easy JOIN.

I also have a ton of reports that this logo (image) needs to appear on. Each report calls its own stored proc for data. I need to modify each stored proc to now also return the logo. It seems to make sense (since the process of getting the right image is complicated) to just call the GetLogo sproc from each report sproc.

The problem I'm having is in getting this info. First, I tried to rewrite the sproc as a UDF, but you can't return a type of Image. Ack. Similarly, trying to EXEC the sproc has the same limitation. I can't do this (because I can't declare a variable of type Image):

DECLARE @logo image
SET @logo = (GetImage...)

I suppose one method would be to create a temp table, and suck the image into there, but then I would likely need to make some major modifications to all the existing report sprocs, and there are a lot of them...

I'm hoping someone out there knows some magic pill that will let help me to grab the friggin image and return it without having perform major surgery on every sproc I've got.

Please help me. :(
Thanks




-Todd Davis

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-23 : 01:20:59
Why do you include this in main stored procedure. you could simply create a seperate datasource to retrieve only images and use it in reports for showing image. use the created datasource as source for image datasets of all reports. Then use database as option for source property of image. give value as field containing image. Also set proper MIME type to view images in report.
Go to Top of Page
   

- Advertisement -