Re: Lookup specific string in all-tables



On Dec 13, 9:26 am, Eric Fung <wkfung.e...@xxxxxxxxx> wrote:
Thanks Keith, using the combine of BCP and GREP shall also do the
trick. Just one more question, regarding to your valuable solution.
What about the table size is huge, would BCP still gonna be the
suitable way to go?

(Sorry that it should be a different topic)

Eric.

On 12月13日, 下午8時00分, Keith <keith.wing...@xxxxxxxxxxxxxxxxx> wrote:

On Dec 12, 8:15 am, David Kerber

<ns_dkerber@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
In article <f5a755b8-feed-4c2b-a53c-
44e02086b...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, wkfung.e...@xxxxxxxxx
says...

Hi I am new to sybase,

May I know how I can find a specific string (filename in one of the
column in one of the table) in a database in which the table's name is
unknown?

I've read a simular article, saying that the only way to do this is to
open a cursor and run through the sysobjects table.

That's pretty much it. Get a list of the user tables and check each of
them for the piece of data you're looking for. If you don't know the
field name either, then you'll also need to scan through the fields list
for each table.

--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).

Depending on the size of the database it may be easier to:

1) Dump your data to flat files using, e.g. dbschema.pl & bcp.
2) "grep" / "find" the search string in the dumped data.

Keith- 隱藏被引用文字 -

- 顯示被引用文字 -


You can bcp the rows out of the table, no matter how big it is AFAIK.
Things to look out for:

1) Make sure you have space. The bcp file for a larger table might be
as large as the dataspace for the table, in my experience.
2) Time. Although bcp is very fast, it still takes time.
3) Filesize limitation in your filesystem. Know what it is. Make
sure you don't have ulimit set. You can get around this by
bcp'ing out the data in separate files, but that' s more work.

It sounds like you've got some good help in the right direction: doing
it in-db. I would consider this a last resort.

Keith
.



Relevant Pages

  • Re: Regarding Timestamp
    ... I have a table with a timestamp field that gets updated by the DB engine. ... The data itself is a small binary column with exactly the data you see in the BCP file. ... It is put that way in the BCP file, and expected to be that way by BCP when it goes back in to the DBMS via BCP. ...
    (comp.databases.sybase)
  • Best Way to Update Table?
    ... Use BCP to extact the data to a text file then write perl ... program to update the BCP file. ... brake the table into 4 tables and then process ...
    (microsoft.public.sqlserver.mseq)
  • Re: Lookup specific string in all-tables
    ... using the combine of BCP and GREP shall also do the ... trick. ... regarding to your valuable solution. ... Depending on the size of the database it may be easier to: ...
    (comp.databases.sybase)
  • create a table prior to bcping data
    ... bcp out data from our reporting server ... Move bcp file to our archival server ...
    (microsoft.public.sqlserver.server)