Postgres Omnis
Das,
Truncate is very common in MS SQL, and it’s much much faster then the
delete command…. at least in MS SQL.
I don’t have any experience with Postgres but I assume it’s the same
concept.
I did a quick check and it appears to be the case too. You can read more
about it here:
www.postgresql.org/docs/9.1/static/sql-truncate.html
Andrew
On Wed, Feb 14, 2018 at 6:59 PM Das Goravani <das@goravani.com> wrote:
>
> I use Postgres too. This one line of code deletes all records from a table:
>
> Do $ctask.tstaobj.$execdirect(‘DELETE FROM customers’)
>
> It doesn’t need to be harder. It’s done from the statement object and you
> just say Delete from
>
>
> > On Feb 14, 2018, at 2:57 PM, Chris Hughes <ataddata@bigpond.net.au>
> wrote:
> >
> > I am trying to delete a whole table with following command.
> >
> > This basic command runs in the PGAdmin window.
> >
> >
> >
> > ; pTableName
> >
> > ; “Truncate” is SQL for delete all records
> >
> > ;
> >
> > Do tSessionObj.$newstatement Returns LvStatementObj
> >
> > If isclear(LvStatementObj)
> >
> > Breakpoint {bug trap}
> >
> > End If
> >
> > Calculate LvSQL as con(‘TRUNCATE TABLE ‘,pTableName,’ RESTART IDENTITY;’)
> >
> > Do LvStatementObj.$prepare([LvSQL]) Returns LvError ;; LvStatementObj
> >
> > Do LvStatementObj.$execute() Returns LvError ;; LvStatementObj
> >
> > If LvStatementObj.$errorcode
> >
> > OK message Truncate Delete Failed {[LvStatementObj.$nativeerrortext]
> > [LvStatementObj.$errorcode]}
> >
> > Quit method kFalse
> >
> > End If
> >
> > Quit method kTrue
> >
> >
> >
> >
> >
> >
> >
> > Chris Hughes
> >
> >
> >
> > Copious Data Pty Ltd (Trading as Atad Data)
> >
> > Unit 8 /3460 Pacific Highway
> >
> > Springwood QLD 4127
> >
> > Phone No:- 07 3208 6347
> >
> > Mobile No:- 0409 263 349
> >
> > Fax No:- 07 3208 9347
> >
> > Email:- ataddata@bigpond.net.au
> >
> > Web Site:- ataddata.com.au
> >
> >
> >
> >
> >
> > _____________________________________________________________
> > Manage your list subscriptions at lists.omnis-dev.com
> > Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com
> >
>
> _____________________________________________________________
> Manage your list subscriptions at lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com
>
—
Sent from iPhone
_____________________________________________________________
Manage your list subscriptions at lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com