I am trying to call the sp_PackTable procedure. I am using the local server and .dbf tables.

Granted, this is the first time I've tried to use the sp_PackTable procedure so I may be doing something stupid. I used the help file to try to determine the proper syntax. I think I have it right. Nevertheless, as soon as ADSQuery2.ExecSQl is called I get the following error:

'...ADSQuery2: Error 7200: AQE Error: State = S0000; NativeError = 2121; [iAnywhere Solutions][Advantage SQL Engine] Column not found: c:\tippsqs\DB\Agency -- Location of error in the SQL statement is: 32'.

I have tried c:\tippsqs\db\agency and c:\tippsqs\db\agency.dbf. When I include the .dbf, the error states "Column not found: dbf"

Any help will be appreciated.

Here's my code:

procedure TfrmTippsqsSetup.cmdDoItClick(Sender : TObject); var AgencyTable : string; begin ( adsconnection1.ConnectPath = c:\tippsqs\db ) AgencyTable := adsconnection1.ConnectPath+'\agency';

adsquery2.SQL.Clear; adsquery2.SQL.Add('Execute procedure sp_PackTable('+AgencyTable+')'); adsquery2.ExecSQL; end;

asked 07 Jul '14, 12:56

rhcarpenter's gravatar image

rhcarpenter
111111218
accept rate: 0%


In general, the table management stored procedures (including sp_PackTable) accept, as the first parameter, the table name or relative table path (relative to the directory that you specified as the ConnectPath for your connection component).

So, if your ConnectPath is c:\tippsqs\db\, and the table you wish to pack resides at c:\tippsqs\db\agency.dbf, and the TableType property of your AdsQuery object is set properly, then your sp_packtable call would be:

EXECUTE PROCEDURE sp_PackTable( 'agency' );

Aside from your specific question, one really good way to test these things is to use Advantage Data Architect. Define a connection in ARC using the same ConnectPath that you are assigning to your AdsConnection object, then you can construct your SQL Query in the query window. Once you have a working version of the query in ARC, you can use the identical syntax/path in your application.

link

answered 07 Jul '14, 13:26

Jed%20Thomet's gravatar image

Jed Thomet
2.7k12648
accept rate: 38%

OK. I'll try this. Basically you're saying I should not be passing the fully qualified filename, only the table name since my connect path already holds the fully qualified path. Is that correct?

(07 Jul '14, 13:40) rhcarpenter

That's correct. The only time you may need a path is if the tables are in a different directory than you're connecting to -- and then, you'll specify the relative path to the table. Hope this helps!

(07 Jul '14, 13:46) Jed Thomet

You may also be in trouble because of quotes in Delphi. Try this:

adsquery2.SQL.Add('Execute procedure sp_PackTable(''' + AgencyTable+''')');
link

answered 07 Jul '14, 14:06

Stephan%20Leiwering's gravatar image

Stephan Leiw...
2.1k173362
accept rate: 19%

1

using parameters might be a better approach

(08 Jul '14, 00:45) Joachim Duerr
Your answer to the original question.
If responding to a request for additional information, please edit the question or use the comment functionality.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×40

Asked: 07 Jul '14, 12:56

Seen: 2,618 times

Last updated: 08 Jul '14, 00:45

Advantage Developer Zone Contact Us Privacy Policy Copyright Info


Powered by Advantage Database Server and OSQA
Disclaimer: Opinions expressed here are those of the poster and do not necessarily reflect the views of the company.