lidds Posted June 3, 2007 Posted June 3, 2007 Hi, I need some help, as always, I currently have a table called 'notificationMessageTbl' and I have a TEXT field called 'userReadID' what I want to do is add text to the end of current text within the field using SQL If I use the following code it just replaces the exsisting text with '12,' and does not append. UPDATE notificationMessageTbl SET userReadID = '12,' Thanks in advance Simon Quote
Administrators PlausiblyDamp Posted June 3, 2007 Administrators Posted June 3, 2007 Would [highlight=sql] UPDATE notificationMessageTbl SET userReadID = userReadID + '12,' [/highlight] not work? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
lidds Posted June 3, 2007 Author Posted June 3, 2007 Unfortunately this give the following error which I think is because the field is a TEXT field not a varchar field.... Invalid operator for data type. Operator equals add, type equals text. Thanks Simon Quote
Administrators PlausiblyDamp Posted June 3, 2007 Administrators Posted June 3, 2007 (edited) My bad - didn't read your question properly ;) try [highlight=sql] UPDATE notificationMessageTbl SET userReadID = concat(userReadID ,'21, ') [/highlight] just out of interest is there a reason why the field has a TEXT datatype? From your code it looks like the field will contain a comma separated list - is this the case? If so could you not split these values out into another table rather than shove multiple values into a single field? Edited June 3, 2007 by PlausiblyDamp Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.