Database Table Names

Posted on 2003-03-16
Medium Priority
Last Modified: 2013-11-23

I hope someone can help me out with this.

I have a database (say, a MS SQL Server DB).  I do a Table.GetTableNames on it and I'm provided with a list of times.  I'm also given the owner of the table (example, dbo.MyTable).

My question is - how can I remove the owner (keeping in mind that the owner name could have more or less than three characters).  And I don't want to manually delete the owner name from the table name.

There MUST be a way of returning just the table name.  I don't mind how it's done - except it MUST be doing using the BDE.

Thanks in advance.

Question by:Stuart_Johnson
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2

Expert Comment

ID: 8149759
Hi Stuart Johnson,
may be something like this:

procedure GetTableNames(DD: TDatabase; List: TStrings; SystemTables: Boolean = False);
  L: TStringList;
  I: Integer;
  L := TStringList.Create;
  DD.GetTableNames(L, SystemTables);
  for I := 0 to L.Count - 1 do
    if Pos('.', L[I]) > 0 then
      L[I] := Copy(L[I], Pos('.', L[I]) + 1, 1000);
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 8150153

  Try to return the tables name using SQL statement

  SELECT name FROM sysobjects where xtype = 'U'

I'm not sure if the it will return the tables owner or not, sorry I don't have SQL server now to test

also look about sp_tables stored procedure, it can return all the tables or the tables for specific user, look in sql server documentation about sysobjects and sp_tables for more info

Best regards
Mohammed Nasman

Author Comment

ID: 8150263
Hi Igor,

What you posted is what I don't want to do.  If the table name is FRED.DBF, then it will cut the FRED. off and just leave me with DBF which is wrong.

SQL Server was an example.  The thing can happen with Oracle as well. But this has to work on everything because it's a database management tool I'm writing.  So please, no examples for one type of database.

There must be away to tell the BDE not to return the owner name.  Surely....


What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Expert Comment

ID: 8150370
there is an advanced function for get list of tables:


it allow you to do not include extensions into table name.

>> There must be away to tell the BDE not to return the owner name.
not sure

LVL 22

Expert Comment

by:Mohammed Nasman
ID: 8150608
BDE designed specifically for Paradox/DBase, then the SQL links added after that, so not all the BDE Functionality   will work with all types of databases as it working with Paradox, for example if you use BDE to work with Sql server, it can only use the feature in SQL server 6.5 only, for MS access it will working with Access 97 and below, and that's true for most of new databases, and Borland put the BDE in maintenance mode, so it will not be updated anymore

I think if you would design your database management tool to work with the general features maybe BDE will work with you, but if you want it to be more advanced, I think you should consider to change it

Author Comment

ID: 8150634
Yeah, that's probably right, Mohammed.  Perhaps it's time to stop the development cycle of this version of my app and start working with something else - maybe ADO would be a better approach?

LVL 22

Accepted Solution

Mohammed Nasman earned 800 total points
ID: 8151056
Stu, For me I prefer ADO more than BDE, but you should know that Ado Optimized for Microsoft Database(Access & Sql Server), but there's some native drivers for other databases like Oracle, and you can access database that don't have native OLE DB driver using ODBC, I have some applications build using ADO and Oracle, but Microsoft OLE DB driver for Oracle doesn't work with BLOB fields, but if you don't use BLOB it will work fine with other fields, Oracle has it's driver for OLE DB, but I haven't tried it

I'm afraid to tell you, that you will not find any DB framework (BDE,ADO,dbExpress) that will work with all databases as you would, but may I'm wrong about that, the best way to connect to database is using Direct Access Conrols, but the problem that your code will be specific for one database, and will need some modification to work with the others

if you look around about database management tools, you will find they publish specific version for each database, for examples look in www.quest.com, they are using Delphi for developing most of thier applications, but they don't have one application will work with all databases

I think ADO can fit with common databases, but not with all

Author Comment

ID: 8164513
Thanks, Mohammed.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

762 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