Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #183
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Gene Wirchenko <genew@ocis.net> |
| Newsgroups | comp.databases.ms-sqlserver, microsoft.public.sqlserver.programming |
| Subject | SSE 2008: A Special Kind of Identity |
| Date | Fri, 15 Apr 2011 13:53:18 -0700 |
| Organization | A noiseless patient Spider |
| Lines | 37 |
| Message-ID | <89bhq613oi4v5l2hfof1uslff7l0io7cjg@4ax.com> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| Injection-Info | mx01.eternal-september.org; posting-host="7Qrvczazr82YckO5XW8Vtw"; logging-data="1994"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+2xB3hiNvsUJ+R3zHma+Up6bhTiugSp7k=" |
| X-Newsreader | Forte Agent 4.2/32.1118 |
| Cancel-Lock | sha1:w2mFCB4QD4WXdf+hmaoBWLkyXVE= |
| Xref | x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:183 |
Cross-posted to 2 groups.
Show key headers only | View raw
Dear SQLers:
I continue slowly putting together a Banking database. I now
want to define the Transactions table. It makes sense to keep
transactions together somehow. For example, a transfer from one
account to another is composed of a transfer out and a transfer in. It
would be good to be able to see all parts of such a batch.
I suppose that transactions could be corrected after the fact, so
I am really only concerned with a batch balancing when it is entered.
How do I generate the batch number? (I do not want the application
doing this. I want it done in a stored procedure.)
If I have a common attribute for each transaction in a batch, I
could do something like:
create table TranBatches
(
BatchNr int identity(1,1),
CommonAttr whoknows
)
This common attribute might be transaction date. The transaction
table would have an FK into TranBatches.
What if there is no common attribute? Then, all I would have is
for TranBatches is a table of numbers. This strikes me as silly.
I suppose that I could roll my own with a table containing the
last batch number generated and add one to it in the stored procedure
I come up with for batch processing, but this strikes me as kludgy.
Is there an elegant way to generate batch numbers for the
transactions table, bearing in mind that a batch number will be used
for more than one row in the transactions table?
Sincerely,
Gene Wirchenko
Back to comp.databases.ms-sqlserver | Previous | Next — Next in thread | Find similar
SSE 2008: A Special Kind of Identity Gene Wirchenko <genew@ocis.net> - 2011-04-15 13:53 -0700 Re: SSE 2008: A Special Kind of Identity Erland Sommarskog <esquel@sommarskog.se> - 2011-04-15 23:55 +0200
csiph-web