473,394 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Insert a jpeg into a column sql server 2000 - desperately seeking help

I'm a complete newbie. Need to insert a Company logo into a database
column to use later on in a check printing application. Read how to
insert the pointer instead of the object into the column. Below is
what I did:

SET QUOTED_IDENTIFIER OFF
GO
INSERT INTO BankInfo
(CoLogo) VALUES(0xFFFFFFFF)

***Then I did this****

DECLARE @Pointer_Value varbinary(16)
Select @Pointer_Value = TEXTPTR(CoLogo)
FROM BankInfo
WHERE CMCo = '91'
WRITETEXT BankInfo.CoLogo @Pointer_Value
"\\192.31.82.77\Data\CheckImages\WyattLogo.jpg "

****This was straight out of a book and it seemed to work it gave me a
message that it was successful and when I view the data in the column
I can see the pointer
0x453A5C436865636B496D616765735C57796174744C6F676F 2E6A7067*****

But when I try to use the column in either Crytal Report or an Access
Report the Bank Logo does not show up. I also placed the logo on my C
drive and tried pointing to it there with "C:\WyattLogo.jpg" with no
success.

It can't be this difficult to get a Company logo into a column. I
desperately need assistance. Remember I am the ultimate newbie. I
looked at my first sql database last week. Thanks in advance for any
help, it is appreciated.
Jul 20 '05 #1
1 1963
rdshultz (rd******@nooter.com) writes:
I'm a complete newbie. Need to insert a Company logo into a database
column to use later on in a check printing application. Read how to
insert the pointer instead of the object into the column. Below is
what I did:

SET QUOTED_IDENTIFIER OFF
GO
INSERT INTO BankInfo
(CoLogo) VALUES(0xFFFFFFFF)

***Then I did this****

DECLARE @Pointer_Value varbinary(16)
Select @Pointer_Value = TEXTPTR(CoLogo)
FROM BankInfo
WHERE CMCo = '91'
WRITETEXT BankInfo.CoLogo @Pointer_Value
"\\192.31.82.77\Data\CheckImages\WyattLogo.jpg "

****This was straight out of a book and it seemed to work it gave me a
message that it was successful and when I view the data in the column
I can see the pointer
0x453A5C436865636B496D616765735C57796174744C6F676F 2E6A7067*****


Alas, it is not that easy. What you have there, is some sort of
binary representation of the URL itselt. (Actually, it is not. This
is from your attempt to use C:\WyattLogo.jpg.) SQL Server is not going out
to access the web or your disk to read the JPEG for you. You need to say:

WRITETEXT BankInfo.CoLogo @Pointer_Value
0xFFD8FFE1D8454578...

Where the hex string is contents of the file itself. The "pointer" in
this context is a pointer with SQL Server, to the special area where the
value for this image column are stored.

So how would you do this in practice? Most commonly, I think people
use the ADO method AddChunk write a program that reads the binary
file and sends down in pieces. But you could of course also write a
program that constructs the entire SQL batch with hexstring and all.
(If you use AddChunk I don't think you need to convert to hexstring.)
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: soni29 | last post by:
hi, i have a small question regarding sql, there are two tables that i need to work with on this, one has fields like: Table1: (id, name, street, city, zip, phone, fax, etc...) about 20 more...
5
by: me | last post by:
I'm also having problems getting the bulk insert to work. I don't know anything about it except what I've gleened from BOL but I'm not seeming to get anywhere...Hopefully there is some little (or...
2
by: Dave | last post by:
I cannot insert into my appointments table because the primary key and identity column, appt_id, cannot be added. What do I have to change in my SQL statement to add new records into this table? I'm...
6
by: pk | last post by:
Sorry for the piece-by-piece nature of this post, I moved it from a dormant group to this one and it was 3 separate posts in the other group. Anyway... I'm trying to bulk insert a text file of...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
0
by: Johann Blake | last post by:
In my need to decode a JPEG 2000 file, I discovered like many that there was no functionality for this in the .NET Framework. Instead of forking out a pile of cash to do this, I came up with the...
11
by: Ted | last post by:
OK, I tried this: USE Alert_db; BULK INSERT funds FROM 'C:\\data\\myData.dat' WITH (FIELDTERMINATOR='\t', KEEPNULLS, ROWTERMINATOR='\r\n');
6
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am...
10
by: MLH | last post by:
Suppose, in a multi-user environment, you have append query SQL in a VBA procedure that looks like INSERT INTO MyTable... and the next line reads MyVar=DMax("","MyTable... You can never be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.