Archives of the TeradataForum
Message Posted: Mon, 14 Apr 2003 @ 00:15:51 GMT
For what it is worth, we have a need to generate sequence numbers on a couple of fronts. There are a couple that we need to generate using the CSUM method.
The first one is our application allows users to supply any SQL statement that they like and we will run it to import data into our application. There are very few rules pertaining to the SQL statement that they supply - pretty much the rules are that it must be a syntactically select statement and that it has to have a customer identifier. One of the problems with these loose rules is that a single customer could get selected multiple times in a single SQL statement (which is perfectly valid). We require that we need to be able to track each record - enter the "System assigned" key value courtesy of CSUM.
Another scenario is in a migration process from one version of our S/W to another. In the newer version we need to generate some new data to support the new functionality. As part of this process we need to generate some key values to support the new data structures. Sometimes the key values from the old data can be used - but not everytime. Again enter systetm assigned key values courtesy CSUM.
There are plenty of other times I have used CSUM to generate values for test data and other purposes on many occassions I could have used more complex approaches - the power of csum is its convenience to generate sequential numbers.
Everyone is so hot on the CSUM (1, col_y) form, I sometimes wonder how many people know what the csum function is "actually intended to do"? For example, I wonder how many people would know (without trying it) what something like this would do CSUM (col_s, col_y) or better yet, csum(col_s, col_y) group by col_z????? Another form which I use quite frequently.
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|