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

"Text" datatype field not inserting

Status
Not open for further replies.

Jayson

Programmer
Jan 31, 2001
75
US
Hello,

I currently have a Trigger on tableA which when a row of data is inserted, it will read that newly input record on tableA and copy/insert onto tableB. Lastly the trigger will then read whatever is inputted on tableB and email it to me.

I think the problems lies on one of the "text" datafield on tableA, all info are being transferred to tableB, except of the "text" datatype field. The email doesn't work too, we figure, it could be the "text" datatype.

this was working when we were using SQL Server 6.5, but when we upgraded to SQL Server 2000, it didn't work anymore.

Here's a sample code for the trigger. Thanks for any suggestion.
The first few lines are use, so as to accomodate for than 255 characters for the "text" datatype field (i.e. comments_4)
===========================================================
IF @comments4 is not null
BEGIN
INSERT tableB values (CHAR(13) + '>> What other information would you like to receive?')
INSERT tableB values (CHAR(13) + CHAR(9))
SELECT @@ptrMail = TEXTPTR(c1) FROM tableB
SELECT @@ptrComments4 = TEXTPTR(inserted.comments_4) FROM inserted
UPDATETEXT tableB.c1 @@ptrMail NULL NULL WITH LOG tableA.comments_4 @@ptrComments4
END


SELECT @emailsendto = 'myself'
DECLARE @@cmd varchar(56)
SELECT @@cmd = 'SELECT c1 FROM Database1.dbo.tableB'
EXEC master.dbo.xp_sendmail @emailsendto,
'',
@@cmd,
'',
'myself',
'',
@subject,
'',
'False',
'False',
'True',
99999
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top