Re: SQL Query needed for testing.

Dale E. Reed Jr. ( (no email) )
Wed, 11 Jun 1997 19:56:53 -0700

Warren Kipp wrote:
>
> Hi Dale,
>
> We need to test/familiarize ourselves with the invoicing procedures.
> I have
> deleted some test/sample invoices, (void didn't work) and now I would
> like
> to set the invoice counter back to 1 (or zero)
>
> Could you please tell me the sql script to:
>
> 1)delete all existing invoices
> 2)Set invoice counter to 0?

This is not an easy think to do. The invoice ID's are created
by SQL Server on the fly. The only way to reset the counter
is to truncate the table. But you can't truncate a table that
has relationships. Therefore, to do this you would have to:

1. Remove all relationships to the invoices table (right click,
select show dependencies to list them).

2. Execute:

Truncate Table Invoices
Truncate Table InvoiceItems

3. Re-create the above relationships you deleted.

-- Dale E. Reed Jr.  (daler@iea.com)_________________________________________________________________       IEA Software, Inc.      |  RadiusNT, Emerald, and NT FAQs Internet Solutions for Today  |    http://www.emerald.iea.com