| Author |
Topic  |
|
|
minimotorsport
Starting Member
Germany
13 Posts |
Posted - 03/26/2002 : 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 faithfully
Michael |
|
|
MichaelP
Jedi Yak
USA
2489 Posts |
Posted - 03/26/2002 : 20:26:21
|
Take a look at: http://sqlteam.com/item.asp?ItemID=1876
That 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
Australia
1478 Posts |
Posted - 03/26/2002 : 21:00:07
|
Hi minimotorsport
From what you said, I think you've got a table like this: PARTNUMBER DETAIL ---------------------- PART01 PART02, PART08, PART04 PART02 NULL PART03 PART05 PART04 PART06, PART07, PART08 PART05 NULL
And you want
PARTNUMBER DETAIL ---------------------- PART01 <b>PART02</b>, PART08, <b>PART04</b> PART02 NULL PART03 <b>PART05</b> PART04 PART06, PART07, PART08 PART05 NULL
Is 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
Germany
13 Posts |
Posted - 03/27/2002 : 04:29:35
|
yes. Any idea ?
yours faithfully
Michael |
 |
|
|
minimotorsport
Starting Member
Germany
13 Posts |
Posted - 03/27/2002 : 05:28:17
|
quote:
Take a look at: http://sqlteam.com/item.asp?ItemID=1876
That 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 4 2 you better use 6 3 8 is cheaper 4 you can also use 1 for that 5 6 better than 2 7 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 cheaper 4 you can also use <B>1</B> for that 5 6 better than <B>2</B> 7
yours faithfully
Michael |
 |
|
|
minimotorsport
Starting Member
Germany
13 Posts |
Posted - 03/27/2002 : 12:52:02
|
how can I do the following ?
for every [Artikelnummer] from webkatalog
do the following
Replace(Detail,[Artikelnummer],"<B>"+[Artikelnummer]+"</B>") from webkatalog
something like that.
yours faithfully
Michael |
 |
|
|
rrb
SQLTeam Poet Laureate
Australia
1478 Posts |
Posted - 04/01/2002 : 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 required
Someone 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" |
 |
|
| |
Topic  |
|