Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem while inserting image type data

Status
Not open for further replies.

tapks

IS-IT--Management
Sep 6, 2001
72
IN
Hi!

while inserting image type data to a table, I am getting the following error :

'Server: Msg 7133, Level 16, State 2, Line 6
NULL textptr (text, ntext, or image pointer) passed to WriteText function.'

My table Test is having the colums
id int,
img image

I am executing the following commands:

INSERT INTO test VALUES (1, NULL)

BEGIN TRAN

DECLARE @ptrval VARBINARY(16)

SELECT @ptrval = TEXTPTR(image)
FROM test
WHERE id = 1

WRITETEXT test.image @ptrval 'x4'

COMMIT

========

Can Anybody help me in resolving the issue?

Thnkx in advance.

TapKs

 
For the WriteText call it says the syntax is
WRITETEXT { table.column text_ptr }
[ WITH LOG ] { data }

and it also says that when creating the text_ptr :
To create a text pointer, execute an INSERT or UPDATE statement with data that is not NULL for the text, ntext, or image column

You are specifically creating the Image field datatype to be a NULL.


"I'm living so far beyond my income that we may almost be said to be living apart
 
Whatever U have mentioned, I have tried all in the above. But the error persists.

Any other solutions ?

Tapks
 
I didnt provide a solution I told you that it says in books online you CANT insert NULL for the image column when you wish to create a text pointer on that field.

A solution may be to create your row with a blank column i.e.
INSERT INTO Test (1, '')


"I'm living so far beyond my income that we may almost be said to be living apart
 
I don't think you should really store the images in a SQL Server table. How about storing a pointer to an image (you can use the file name, directory name or URL). The actual image can be stored on a file system or on the web server.

It's actually quite easy to write ASP code to build an image tag. The tag you can customize with the image name extracted from the database
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top