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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default value for image column?

Status
Not open for further replies.

kdelacruz

Technical User
Oct 7, 2002
25
0
0
ES
Hello,

I have an column whose datatype is image, and I would like to set a default image for it. Actually, I just want some kind of value in it, even if I can put some text in there. I just don't want it to be null.

I can't figure out how to do this in the Table Design in Enterprise Manager (the normal way , and I've also researched creating an insert trigger to insert a picture, but everything I've found says that you can't reference an image column in a trigger.

I did find TEXTCOPY, which you can use from the command line, but I don't know if you can use this from a trigger.

Does anyone know how I can do this?

We have an application (made by an outside vendor) that prints keycards for our cruise ship passengers, and the program requires that the photo field not be null in order to print a card, but this causes problems because the passenger cannot always be present when the key needs to be printed.


If anyone has any ideas, they wouldd be much appreciated!


Thanks!

Kathy
 
Default value for the field in the design window in EM will get rid of nulls.


Code:
CREATE TABLE [Table1] (
	[a] [int] IDENTITY (1, 1) NOT NULL ,
	[b] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
        [c] [image] NULL CONSTRAINT [DF_Table1_c] DEFAULT ('')
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

1,2,3 had 'test' as default value; 4 had nothing; 5,6 had empty string ('')

Code:
a           b          c
----------- ---------- 
1           a          0x74657374
2           b          0x74657374
3           c          0x74657374
4           d          NULL
5           e          0x
6           f          0x
 
(6 row(s) affected)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top