Please follow the basic Netiquette of all SQL forums. Post DDL that follows ISO-11179 rules for data element names. Use ISO-8601 formats for temporal data. Use induSTRy standard encodings (ISBN, UPC, GTIN, etc) and avoid needless dialect. Give clear specifications. Give sample data.
If you do not know that rows are not records, fields are not columns and tables are not files, then you should not be posting. SQL is a declarative language, so we hate cursors. We hate local variables, too.
Using upper case letters is a code smell that says your mindset is still in punch cards and sequential processing. And finally you used a date in a data STRuctured name! Back in the 1960's, this is how we named magnetic tapes. In RDBMS, we name tables for the set of entities they model.
Why are you using FLOAT? Is there really household number like 3.141592653 in your data model? But if it is really an integer, you still screwed up. What math do you do with it?
The USPS standards use 5 lines of VARCHAR(35) for a Street address. But you pack all of that in CHAR(50). Think about how vague “cluster” is – Size? Name? Location? WHAT??
The purpose of PRINT in T-SQL is debugging and not output. The purpose of SQL is to handle the data, not to format and display data, like you are doing. Learn what a “presentation layer” in RDBMS is.
Follow the rules, and post that DDL, then we will try to help you. All you can get is a stinking kludge with this posting.
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking in Sets / Trees and Hierarchies in SQL
No comments:
Post a Comment