October 23, 2007 at 12:54 pm
Hi All!
I have a "sitch" in where I need to build a table that will hold Image data along with some minor indexing type info. I do not have access to any high level languages such as C# or VB.Net. I have to test this via SQL. So...
I need some T-SQL that I can use to insert image dataype (along with indexing info) and/or varbinary data.
Then I need some basic T-SQL to read this data from the table.
This is all in testing and therefore tables/ data can be changed if necessary.
So here is the table:
CREATE TABLE [dbo].[ImageStore] (
[Identity] [int] NOT NULL ,
[Description] [varchar] (8000) NULL,
[Image] [image] NULL ,
[BlobData] [varbinary] (8000) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
Now I have a PDF document called "c:\temp\TSQL_For_Dummies.PDF" that I want to insert into this table as image AND varbinary. How to start?
Then once it is there, how to retrieve?
Sorry to sound so ignorant, but this very very new ground for me.
Thanks a ton in advance!
P.S.
If there are any image viewing tools that are good at reading image and varbinary data from the database and presenting it in a viewable format to show that everything is working as expected, it would be greatly appreciated (for any GIFs/JPEGs, etc...).
JT
October 23, 2007 at 2:13 pm
Jason, you probably will not be able to "see" most of your files directly on the server using SQL. Unless you have Adobe installed on your machine, for example, it has no way of reading it. Same goes for other file types that might need a program to open them. There may be some work around, though.
Greg
_________________________________________________________________________________________________
The glass is at one half capacity: nothing more, nothing less.
October 23, 2007 at 2:30 pm
Yeh. I kinda figured that there may be a little catch with format that is specific such as Adobe Acrobat. But I am more interested in the SQL for inserting and selecting the data. I did find a site that had C# code and it looks like the SQL is very straight forward and that the APIs handle all the necessary work on getting the data loaded and retrieved. I just wanted to have something to use as a testing tool from my end to verify data and get a better understanding of how image data is different than say varchar.
BOL has code, but it is straight text. Although I am sure that it is all treated the same, the example will still run if the column is varchar(100) instead of image.
Thanks for the quick reply.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply