Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 18-02-2009
Member
 
Join Date: Aug 2008
Posts: 145
Searching occurence of a word or string from the database?

Hi,

I want to know how can i find a word (string) in a database along with its no. on times it occured in the table or database? In short i need a script for this!
Is this possible to generate from back-end database to my vb.net application?

Regards,
Reply With Quote
  #2  
Old 18-02-2009
Member
 
Join Date: May 2008
Posts: 13
Re: Searching occurence of a word or string from the database?

Simply pass the proc a value and it will search the entire database reporting every occurence of the word in tables, views, stored procedures, functions, etc...

Best of all, if you create a key stroke shortcut to execute the proc, you can highlight any text in your editor and search for it instantly. And because the proc's only parameter is of type SQL_VARIANT, there's no need to
surround the input parameter with single quotes! Hightlight, click, and find!
Reply With Quote
  #3  
Old 18-02-2009
Member
 
Join Date: May 2008
Posts: 184
Re: Searching occurence of a word or string from the database?

I found the answer to my prob (I added a question here yesterday), and maybe I can help you out. Its really quite easy (I think) just backup your database and save it to your desktop, unzip it and open with notepad. Select all, copy ...and then paste in word and then find replace all word instances (which you want with something else) ...word will count and show you how many instances there are...I dont think notepad can do it (count).

Cheers
Reply With Quote
  #4  
Old 18-02-2009
Member
 
Join Date: May 2008
Posts: 26
Re: Searching occurence of a word or string from the database?

Write a text file containing the input string. For example I have created a file named test.txt containing the following string

swdfkTRUEafjknsdfTRUEasdfjkTRUEasf

goto the directory where the file "text.txt" is located.

run the following command

awk -F "TRUE" '{print NF-1}' test.txt | awk '{ c+= $1} END { print c }'

Code:
[root@mii temp]# cat test.txt 
swdfkTRUEafjknsdfTRUEasdfjkTRUEasf
[root@mii temp]# awk -F "TRUE" '{print NF-1}' test.txt | awk '{ c+= $1} END { print c }'
3
[root@mii temp]#
Reply With Quote
  #5  
Old 18-02-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: Searching occurence of a word or string from the database?

I have this example to find the occurance of a type of word in a string I hope this will help you with the logic to develop your word search criteria.

Code:
Private Sub Command1_Click()
Dim myArr() As String, myWord As String
Dim x As Long

myWord = "hello,world,15247"

myArr = Split(myWord, ",")

For x = 0 To UBound(myArr)
    If IsNumeric(myArr(x)) Then
        List1.AddItem myArr(x) & ": Number"
    Else
        List1.AddItem myArr(x) & ": VarChar"
    End If
Next

End Sub
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Searching occurence of a word or string from the database?"
Thread Thread Starter Forum Replies Last Post
How to check if a bad word is present in a string using PHP mpchekuri Software Development 1 25-03-2012 12:07 PM
Creating Database link in database Lachlann Software Development 3 28-01-2010 01:17 PM
How to Manipulate String using PHP String Functions ComPaCt Software Development 3 21-09-2009 09:07 AM
Auto fill word document from database kaotix MS Office Support 2 08-08-2008 06:09 PM
convert filemaker pro database to access database Czack MS Office Support 3 15-04-2007 01:06 AM


All times are GMT +5.5. The time now is 07:28 AM.