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.
Author |
Topic |
minimotorsport
Starting Member
13 Posts |
Posted - 2002-03-26 : 19:26:52
|
I have product database (webkatalog) with a string field (Detail) witch may contain one or more Partnumbers.I want to put tags around them , if the Partnumber is also in the database.I have tried some:Replace(Detail,partnumber,"<B>" + partnumber +"</B>")but can not find the right Select to find all partnumbers.yours faithfullyMichael |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2002-03-26 : 20:26:21
|
Take a look at:http://sqlteam.com/item.asp?ItemID=1876That shows you how to find keywords in a varchar field in a table. You should be able to apply the same concepts to find the partnumbers in your field. If I'm reading correctly, I think what you wnt to do is put all the part numbers into a temp table that contains the RecordId and the partnumber. Each RecordID could have multiple part numbers associated with it. Once you have this table, you should be able to fairly easily update the "detail" field by selecting from this temp table.Could you also post a few sample records of the "Detail" field? That would greatly help as well. |
|
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2002-03-26 : 21:00:07
|
Hi minimotorsportFrom what you said, I think you've got a table like this:PARTNUMBER DETAIL----------------------PART01 PART02, PART08, PART04PART02 NULLPART03 PART05PART04 PART06, PART07, PART08PART05 NULLAnd you wantPARTNUMBER DETAIL----------------------PART01 <b>PART02</b>, PART08, <b>PART04</b>PART02 NULLPART03 <b>PART05</b>PART04 PART06, PART07, PART08PART05 NULLIs that right?--I hope that when I die someone will say of me "That guy sure owed me a lot of money" |
|
|
minimotorsport
Starting Member
13 Posts |
Posted - 2002-03-27 : 04:29:35
|
yes. Any idea ?yours faithfullyMichael |
|
|
minimotorsport
Starting Member
13 Posts |
Posted - 2002-03-27 : 05:28:17
|
quote: Take a look at:http://sqlteam.com/item.asp?ItemID=1876That shows you how to find keywords in a varchar field in a table. You should be able to apply the same concepts to find the partnumbers in your field. If I'm reading correctly, I think what you wnt to do is put all the part numbers into a temp table that contains the RecordId and the partnumber. Each RecordID could have multiple part numbers associated with it. Once you have this table, you should be able to fairly easily update the "detail" field by selecting from this temp table.Could you also post a few sample records of the "Detail" field? That would greatly help as well.
partnumber Detail____________ ______________________________________________1 like that in blue use 3 or 42 you better use 63 8 is cheaper4 you can also use 1 for that5 6 better than 27 and thats what I want to have:partnumber Detail____________ __________________________________________________1 like that in blue use <B>3</B> or <B>4</B>2 you better use <B>6</B>3 8 is cheaper4 you can also use <B>1</B> for that5 6 better than <B>2</B>7 yours faithfullyMichael |
|
|
minimotorsport
Starting Member
13 Posts |
Posted - 2002-03-27 : 12:52:02
|
how can I do the following ?for every [Artikelnummer] from webkatalogdo the followingReplace(Detail,[Artikelnummer],"<B>"+[Artikelnummer]+"</B>")from webkatalogsomething like that.yours faithfullyMichael |
|
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2002-04-01 : 19:52:58
|
Sorry, but I can't see any easy way. I think you're going to probably (dare I say it) * cursor through each record* loop through each ocurrence of partnumber in each string* check for a match and insert <b></b> tags as requiredSomeone else may know a better method, but straight after the easter long-weekend - quite frankly I can't see it...--I hope that when I die someone will say of me "That guy sure owed me a lot of money" |
|
|
|
|
|
|
|