Results 1 to 15 of 15

Thread: ask - search a text in whole database

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    86

    ask - search a text in whole database

    hi there..

    I need help. I use visual basic 6. I want to make program that can search text in one database (SQL). that text can be as record or field.

    in one database there is many table, so I want to make program that can search for a text in each record in each fieldname in each table in one database, can I?
    also, I want search for a text in each fieldname in each table in one database, can I?

    Database is stored in sql 2000.
    thanks before

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: ask - search a text in whole database

    That is possible but why do you want such?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    86

    Re: ask - search a text in whole database

    because we have application that use database, and that database stored in sql server. there is an error when application call data from that database to make a report. I know what string I must search, but I don't know where that string stored.
    may you explain me how to do that?
    thanks

  4. #4
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: ask - search a text in whole database

    Why don't you know what table and column to search for a specific data? Searching each column of each table would be a lengthy process and you have to consider that they are using different data types also.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    86

    Re: ask - search a text in whole database

    ok, that application built by someone, and that person hard to be contacted. As I know, all data types are string.
    If we wait until we can reach that person, it will hold so much our tasks.
    that's why we need code like that. thanks

  6. #6
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: ask - search a text in whole database

    How long do you have? What would be the expectation of the amount of time to search each field of each record of each table for a work or phrase that in anywhere in it?
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    86

    Re: ask - search a text in whole database

    I have a task until end of december (before dec 25), because this is not only my job, I hard to spend more time for search this. So I think I can make small application that can search what I want, meanwhile I do my other task.
    thanks

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    86

    Re: ask - search a text in whole database

    hello....no one want help me?

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    86

    Re: ask - search a text in whole database

    hello???
    where are you all???
    I need this code...
    oh boy, my boss has angry to me.

  10. #10
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: ask - search a text in whole database

    The question I asked was retorical.... on time anyway. What about the rest... Is the phrase at the beinging of the field, the end of the field or anywhere in the field?

    The time ask was this will take a very long time to perform.... You are doing a wild card seach of the entier database. That is a long and costly process... You can limit the seach some what if you exclude columns that are numerical,date,image or binary types.

    I'm working also.... This is not my job to do yours.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  11. #11
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: ask - search a text in whole database

    You can do a search on how to enumerate the tables and how to enumerate all the fields in a table.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    86

    Re: ask - search a text in whole database

    to GaryMazzone,
    hi, I'm really sorry, I don't mean to act like that
    anyway, all fields are string. thanks

  13. #13
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: ask - search a text in whole database

    The like this Select * from tablename where fieldname like '%whaterveryouarelookingfor%'

    This needs to be done for every field in every table. I hope you do not have a lot of tables with a lot of fields and a lot of rows. This will take a long time to finish
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  14. #14
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: ask - search a text in whole database

    CHARINDEX could also be used to determine the existence of a string in another string.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  15. #15

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    86

    Re: ask - search a text in whole database

    Quote Originally Posted by GaryMazzone View Post
    The like this Select * from tablename where fieldname like '%whaterveryouarelookingfor%'

    This needs to be done for every field in every table. I hope you do not have a lot of tables with a lot of fields and a lot of rows. This will take a long time to finish
    that's the problem, yes we have a lot lot lot fields and rows..

    Why I think I need search tool like this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width