[487] in sapr3-soft
Re: deleting tables
daemon@ATHENA.MIT.EDU (cbbrowne@news.brownes.org (Christo)
Sat Oct 11 19:57:26 1997
To: sapr3-soft@MIT.EDU
Date: 11 Oct 1997 18:50:05 -0500
From: cbbrowne@news.brownes.org (Christopher B. Browne) (by way of SAP Moderator <cbbrowne@news.brownes.org>)
On 9 Oct 1997 07:30:20 -0500, Frode R=F8ed <> posted:
>I'v only worked with SAP for one and a half moth as a ABAP/4 programmer,
>so I am still trying to find my way around SAP.
You may want to be careful about deletion of data; SAP AG has the
"suggestion" that using direct table access to modify data is often
not the best way. If you're not sure what you're deleting, you can do
some rather substantial damage to system integrity...
>My question is: how do I delete the contents of a tabel ?
>
>I have a table (database table, not internal) call ZNEWS and I want to
>empty it befor I fill it up with data again.
>
>I tried "delete znews." but the compiler told me that I needed a where
>statement. So I tried "delete znews where '1' =3D '1'. " This would have
>worked with normal SQL but the compiler still complained. What does it
>take to delete a table ??
At least it's a "Z" table, and *probably* safe to nuke out.
You need for the "where" clause to actually reference something
that is in the table.
For instance, if znews has the field "myfield", you might try:
* Delete entries where znews-myfield equals 'something'
delete znews where myfield =3D 'something'.
More useful for your purpose would probably be:
* Delete entries where znews-myfield starts with a "5"
delete znews where myfield like '5%'.
* Delete entries where znews-myfield starts with "ZFAM"
delete znews where myfield like 'ZFAM%'.
And the one that should "do the trick," doing what you really
want done...
* Delete entries where znews-myfield has any value...
delete znews where myfield like '%'.
--=20
Christopher B. Browne, cbbrowne@hex.net, chris_browne@sabre.com
Head-Hunting URLs: <http://www.hex.net/~cbbrowne/headhunters.html>
<http://www.hex.net/~cbbrowne/history.html>
<http://www.hex.net/~cbbrowne/sap.html>
----------------------------------------------------
comp.soft-sys.business.sap is a moderated newsgroup.
Postings are archived and available from the
Realtime USA web site at http://www.realtimeusa.com
----------------------------------------------------