Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

Database Table Names


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.

  • 3
  • 3
  • 2
1 Solution
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);
Mohammed NasmanSoftware DeveloperCommented:

  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
Stuart_JohnsonAuthor Commented:
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....



Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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

Mohammed NasmanSoftware DeveloperCommented:
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
Stuart_JohnsonAuthor Commented:
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?

Mohammed NasmanSoftware DeveloperCommented:
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
Stuart_JohnsonAuthor Commented:
Thanks, Mohammed.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now