Re: how to sum a text field with commas
- From: "Tony Rogerson" <tonyrogerson@xxxxxxxxxx>
- Date: Wed, 23 Dec 2009 21:22:37 -0000
BY DEFINITION a column has scalar values, this is not a valid value in
SQL. This violates a thing called First Normal Form (1NF) which you
I think you are confusing the query language (SQL, or in this product TSQL) with database design.
In database design yes, you would eradicate this type of structure.
SQL is querying - nothing more.
You also show a sheltered existence, really, have you never had to chop and refine data - would you honestly write a separate one off program in C when in a fraction of the time you could cut and massage the data into a structure you want and conforms to proper database design principles?
--ROGGIE--
"--CELKO--" <jcelko212@xxxxxxxxxxxxx> wrote in message news:6ab35ce4-1acc-48cb-8c6e-08bb960ccc6a@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a field [sic: columns are not fields] that contains values like "1,3,0,0" and "2,0,0" and "1". I need to sum those values within the field [sic]. The field [sic] can have up to 100 numbers separated by commas. How can I do sum them? <<
BY DEFINITION a column has scalar values, this is not a valid value in
SQL. This violates a thing called First Normal Form (1NF) which you
will find in the first few chapters of a book on RDBMS.
You can find lots of stinking kludges to parse strings, but the right
answer is to design a proper schema and fire the guy who did this.
If you use a kludge, be sure to include code to raise all the errors
that a parameter in a procedure call can raise. The cowboy coders
never bother with that part ..
.
- Follow-Ups:
- Re: how to sum a text field with commas
- From: --CELKO--
- Re: how to sum a text field with commas
- References:
- how to sum a text field with commas
- From: RedGlow06
- Re: how to sum a text field with commas
- From: --CELKO--
- how to sum a text field with commas
- Prev by Date: Re: how to sum a text field with commas
- Next by Date: Re: loop between 2 datetime field values
- Previous by thread: Re: how to sum a text field with commas
- Next by thread: Re: how to sum a text field with commas
- Index(es):
Relevant Pages
|