[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Session.GetTableNames

Posted on 2002-04-21
9
Medium Priority
?
798 Views
Last Modified: 2008-02-01
Folks,

Can someone help me out with this.  It's annoying me.

I need to copy data from one database to another.  I've got a list of tables from my SQL server on one side (source) and a list tables on my AS/400 on the other side (target).

The problem is, the SQL server gives me the owner name - dbo.Tablename.  The AS/400 doesn't have the prepended owner name.  I need to know HOW do I list the tables without their owner shown?  This also happens with Oracle.  Currently, I've hardcoded it to delete the owner name, but this won't work on systems which have owner's called anything but dbo.

Any help would be appreciated!

Stu
0
Comment
Question by:Stuart_Johnson
  • 4
  • 3
  • 2
9 Comments
 

Expert Comment

by:lottol
ID: 6958993
try to use next method of default object Session

procedure GetTableNames(const DatabaseName, Pattern: string; Extensions, SystemTables: Boolean; List: TStrings);

0
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 6958996
Hi lottol,

I am already using that procedure:

Session.GetTableNames(AliasName, '*', false, false, TableList);

It returns EVERYTHING including system tables (which, as you can see, I told it to omitt).  I'd love to be able to remove the system tables from the list (for instance, in SQL Server, dtProperties, sysalternatives, sysconstraints etc).

Do you know how I can remove the prepended owner and/or the system tables?

Thanks for the help,

Stu
0
 
LVL 1

Accepted Solution

by:
Alone earned 400 total points
ID: 6959883
const
  OwnerDelimiter = '.';
var
  P, I: Integer;
begin
  Session.GetTableNames(AliasName, '*', false, false, TableList);
  for I := 0 to TableList.Count - 1 do
  begin
    P := AnsiPos(OwnerDelimiter, TableList[I]);
    if P <> 0 then TableList[I] := Copy(TableList[I], P + 1, MaxInt);
  end;
end;

WBR...
0
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.

 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 6959952
Alone,

That is how I'm sort of doing it now.  I was hoping that there may have been a "nicer" way of doing it.  If there's not then I guess this will have to do.

Stu
0
 
LVL 1

Expert Comment

by:Alone
ID: 6959995
IMHO, BDE has no other, "nicer" way. :-((

WBR...
0
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 6961496
Hi Alone,

Thanks for that.  It's a real shame that it doesn't.  I'll accept your comment as an answer.

Do you  happen to know if there is a way to omit system tables from the list?  I know you can pass a boolean to the GetTableNames function, but it doesn't seem to make any difference.  You'll still get the points for this question regardless, but if you know off the top of your head, I'd appreciate it if you could share it with me :)

Thanks,

Stu
0
 

Expert Comment

by:lottol
ID: 6961866
Just tested it with ADO

ADOConnection1.GetTableNames(ListBox1.items, false);

It works.
0
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 6961972
Hi Alone,

Mmm.  Unfortunately I'm not able to use ADO (although future versions of our app may go that way).  Thanks for the information anyway.

Stu
0
 

Expert Comment

by:lottol
ID: 6962026
Hmm...
I'm lottol, not Alone
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

834 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