Solved

update rank of tag if word in mentioned in the caption

Posted on 2014-01-29
6
241 Views
Last Modified: 2014-01-29
Dear all,
Need to update NewsSYSNewsTags.RankInCaption= 5
where NewsSYSTags.TagTitle IN STRING of News.NewsCaptionAR
and
News.NewsID=1011 and  NewsSYSNewsTags.NewsID=1011 and
NewsSYSNewsTags.NewsSYSTagsID  = NewsSYSTags.NewsSYSTagsID

thanks
0
Comment
Question by:ethar1
  • 4
6 Comments
 

Author Comment

by:ethar1
ID: 39817747
I have 3 tables
News : NewsID , NewsCaptionAR
NewsSYSTags : where I store unique tags (NewsSYSTagsID (pk) , TagTitle  )
NewsSYSNewsTags : where I store (NewsSYSNewsTagsID =pk) , NewsID , NewsSYSTagsID (fk)
0
 
LVL 12

Accepted Solution

by:
Harish Varghese earned 450 total points
ID: 39817803
Try this:
update NewsSYSNewsTags
Set NewsSYSNewsTags.RankInCaption = 5 
From NewsSYSNewsTags, NewsSYSTags, News
where NewsSYSNewsTags.NewsSYSTagsID  = NewsSYSTags.NewsSYSTagsID
and News.NewsID = NewsSYSNewsTags.NewsID
and IndexOf(rtrim(NewsSYSTags.TagTitle), News.NewsCaptionAR) > 0 -- Tag appears in Caption
and News.NewsID = 1011 --Look for specific news

Open in new window

-Harish
0
 
LVL 59

Assisted Solution

by:Kevin Cross
Kevin Cross earned 50 total points
ID: 39817929
Harish, I think you meant CHARINDEX versus INDEXOF above.
CHARINDEX: http://technet.microsoft.com/en-us/library/ms186323.aspx

Note: you may get a few false positives if your tag is a common part of other words.  For example, suppose your tag is "bask" then it will match to "basket" and "basketball."  As another aside, if you enabled full-text search on SQL Server, you may be able to use those functions to assist you here.

Anyway, I just wanted to assist with the correct T-SQL function to find index of character/string as INDEXOF is not valid for Microsoft SQL Server.  You need CHARINDEX, PATINDEX, or full-text search like CONTAINS.

Full-text: http://technet.microsoft.com/en-us/library/ms142571.aspx

I hope that helps!
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Closing Comment

by:ethar1
ID: 39818070
thanks guys
0
 

Author Comment

by:ethar1
ID: 39818222
0
 

Author Comment

by:ethar1
ID: 39818496
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now