Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Search in sql Text column

Author  Topic 

palak
Yak Posting Veteran

55 Posts

Posted - 2009-01-07 : 13:28:04
Hi friends,

i have sql query below:

select textmessage, textdate, textsubject, texttitle, textemailid, textlist from textmember
where textlist = 'active'

i have first column name - TextMessage which is txt datatype in Textmember table... i have to find the textnumbers if existing in that whole textmessage... and add a new colum in that table - textnumber and all textnumbers will be shown in that column. how can i do that? any help would be appreciated..many thanks..

revdnrdy
Posting Yak Master

220 Posts

Posted - 2009-01-07 : 13:39:07
Hello !

Well to start with you would have to create the column textnumber first using an alter table statement.

I would use the power of regular expressions for this task since the textnumber was not clearly defined in your post (ie.. don't know what a textnumber can look like or where it may appear in a textmessage).

You may need to wish to write a stored procedure to parse through the
textmessage column and compare the text to a regular expression.

I am of course presuming you can use regex on text datatypes. I usually use them on varchar columns.

Here is a very good post from this forum on how to deploy regular expressions
[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=27205[/url]

r&r

Never judge someone until u have walked a mile in their shoes. This way you can be a mile away and you have their shoes!
Go to Top of Page
   

- Advertisement -