Results 1 to 5 of 5

Thread: Searching occurence of a word or string from the database?

  1. #1
    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,

  2. #2
    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!

  3. #3
    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

  4. #4
    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]#

  5. #5
    Join Date
    Oct 2005
    Posts
    2,393

    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

Similar Threads

  1. How to check if a bad word is present in a string using PHP
    By mpchekuri in forum Software Development
    Replies: 1
    Last Post: 25-03-2012, 12:07 PM
  2. Creating Database link in database
    By Lachlann in forum Software Development
    Replies: 3
    Last Post: 28-01-2010, 01:17 PM
  3. How to Manipulate String using PHP String Functions
    By ComPaCt in forum Software Development
    Replies: 3
    Last Post: 21-09-2009, 09:07 AM
  4. Auto fill word document from database
    By kaotix in forum MS Office Support
    Replies: 2
    Last Post: 08-08-2008, 06:09 PM
  5. convert filemaker pro database to access database
    By Czack in forum MS Office Support
    Replies: 3
    Last Post: 15-04-2007, 01:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,885,352.68684 seconds with 17 queries