Pervasive
Sign in | Join | Help
in

New to Pervasive - Need basic help

Last post 05-16-2008 10:17 AM by defiantclass1. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 05-15-2008 10:14 AM

    New to Pervasive - Need basic help

    I just installed the version 8.6 workgroup engine. I have attached to a Btrieve database in a test only enviornment and I want to run some simple delete queries to delete all rows of tables in my database. Or as an alternative, copy the table structures without the data. Either way, in the end, I want to have empty database tables.

     I am not familiar with the Pervasive syntax and my SQL statements are not working. I tried DELETE * FROM TableName and DELETE FROM TableName nither one worked.

     Any help would really be appreciated. I don't intend on working with this a lot, I just need to get this one thing done.

    Thanks

  • 05-15-2008 10:39 AM In reply to

    Re: New to Pervasive - Need basic help

    For SQL, "delete from tablename" is correct.    What error message did you get when you did this?  Assuming that select * from tablename worked for you.

    Jose 

     

  • 05-15-2008 10:53 AM In reply to

    Re: New to Pervasive - Need basic help

    Thank you.

    Yes, this is strange to me. My table name, for example, is Order Charges A. So I created a new view as SELECT * FROM "Order Charges A" and I named the view OrderCharges. The query executes and I can see the rows. But the statement above the grid now reads SELECT * FROM "OrderCharges" not "Order Charges A". I don't understand that. Why does it replace my table name in the statement with the name of the View???

    But to answer your question, yes, the Select statement seems to work.

    Now, when I create a View as DELETE FROM "Order Charges A", the check syntax clears, but when I click OK to save the view I get this: [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface]Syntax Error: CREATE VIEW "Delete" AS DELETE<< ??? >>  FROM "Order Charges A"

    So, my syntax seems to be ok, but it finds a problem when I try and save it.

  • 05-15-2008 11:56 AM In reply to

    Re: New to Pervasive - Need basic help

    I don't think you can perform a Delete within a view.  I'm not really sure why you'd want to either. 

    What are you trying to accomplish?  

    Mirtheil
    I do not answer question via email. Please post questions in the forum.
  • 05-15-2008 12:15 PM In reply to

    Re: New to Pervasive - Need basic help

    If I can't perform a Delete from a view, where else would one do that?

    As for what I am doing..... I want to create an empty database for testing for an internal matter we have.

  • 05-15-2008 12:37 PM In reply to

    Re: New to Pervasive - Need basic help

    I wasn't clear, why do you want to create a view to delete the records.  Views are for stored SELECT statements. 

    As far as how to do it, just issue the DELETE statement through the Pervasive Control Center.  The statement would be:

    DELETE FROM "Order Charges A"

     

    Mirtheil
    I do not answer question via email. Please post questions in the forum.
  • 05-15-2008 1:06 PM In reply to

    Re: New to Pervasive - Need basic help

    I see. Well, I'm not sure what you by that. I am in the Pervasive Cntrol Center. Under Engines, I have my databases. I go to one of them and expand it to see the tables. I assumed that to delete the rows within any of these tables I would create a query/view to do so.

    Are you suggesting I open an existing table and write this statement in there?

    OHHHH, I just did that! I think that worked!! WOW, thanks man!

  • 05-16-2008 10:05 AM In reply to

    Re: New to Pervasive - Need basic help

    Could I ask one more question on this?

     I'm working on a low end computer. One of these tables I am deleting records from is very large and when I try to delete the records, as I have in the other tables, the program freezes up. Is there a TOP type of stement I could use to limit the number of rows I am deleting? Such as DELETE TOP 10000 FROM TABLE?

    Thanks. I've tried this as well as SET ROWCOUNT 10000 DELETE.............. Those didn't work either.

  • 05-16-2008 10:14 AM In reply to

    Re: New to Pervasive - Need basic help

      You can always call the delete with a restriction so that not all the records are being deleted.  Examples:

    delete from person where  id  < 220543134   

    delete from table where lastname < 'Smith'

    Jose

     

     

  • 05-16-2008 10:17 AM In reply to

    Re: New to Pervasive - Need basic help

    Thats a good idea, I'll try that! Thanks
Page 1 of 1 (10 items)
© 2008 Pervasive Software Inc. All Rights Reserved.