Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Cardinal

Author  Topic 

GoDaddy
Yak Posting Veteran

64 Posts

Posted - 2009-05-06 : 11:34:19
I was wondering if there was a way to store cardinal, north east west south?

Or I have no choice to create a table to store the cardinal?

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2009-05-06 : 11:46:45
Please clarify. I am not following what you need exactly.


Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881
Go to Top of Page

GoDaddy
Yak Posting Veteran

64 Posts

Posted - 2009-05-06 : 11:57:32
I need in a table to store the cardinal like North East West South. I was just wondering if there was already a built in table in sql server that provides that enumeration .... but I doubt it, so I'd prolly have to create a table for Cardinals
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-05-06 : 13:18:32
You don't even need a table for this:
CREATE VIEW Cardinal AS SELECT 'North' Direction 
UNION ALL SELECT 'South'
UNION ALL SELECT 'East'
UNION ALL SELECT 'West'

Go to Top of Page

GoDaddy
Yak Posting Veteran

64 Posts

Posted - 2009-05-06 : 13:24:05
yeah but I need to store it as a FK in another table. I am going to create a table for this.

If there is another way let me know :)
Go to Top of Page

whitefang
Enterprise-Level Plonker Who's Not Wrong

272 Posts

Posted - 2009-05-06 : 13:28:43
Use an enumerated data type in your application layer.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-05-06 : 13:56:00
quote:
yeah but I need to store it as a FK in another table. I am going to create a table for this.
Add a check constraint to the columns that need it:
ALTER TABLE myTable ADD CONSTRAINT CHK_Cardinal CHECK (DirectionColumn IN ('North','South','East','West'))
Granted, you can put this in a table, but the storage is excessive for a well-defined domain that will never (or likely never) change.
quote:
Use an enumerated data type in your application layer.
That does nothing to guarantee data integrity in the database, even if (and it's a big if) you apply it to all your applications that use it.
Go to Top of Page

whitefang
Enterprise-Level Plonker Who's Not Wrong

272 Posts

Posted - 2009-05-06 : 14:00:27
It guarantees data integrity in an enterprise environment where DB access is secure and nobody directly edits tables and application business logic is well tested.
You can even define a custom user defined data type.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-05-06 : 14:26:35
quote:
It guarantees data integrity in an enterprise environment where DB access is secure and nobody directly edits tables and application business logic is well tested.
If that's been your experience, good for you. You're lucky. 99% of the rest of us aren't.

Also, there's no rule you can't have this constraint in both the application and the database. You can never have too much integrity checking.
Go to Top of Page

whitefang
Enterprise-Level Plonker Who's Not Wrong

272 Posts

Posted - 2009-05-06 : 14:31:22
quote:
Originally posted by robvolk
Also, there's no rule you can't have this constraint in both the application and the database. You can never have too much integrity checking.



It's called maintenance and out of scope/obsolete objects especially when you work on multiple systems and have timelines and budgets.
Go to Top of Page

GoDaddy
Yak Posting Veteran

64 Posts

Posted - 2009-05-06 : 14:39:18
:) thanks for the replies, its enriching your discussion.

I'll stick with a table.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-05-06 : 14:57:05
quote:
It's called maintenance and out of scope/obsolete objects well-thought-out design to accommodate future expansion especially when you work on multiple too many new, unneeded systems and have timelines and budgets and will therefore skimp or skip on requirements and design documentation
FTFY.

If all the new code is written to access the same data source, then the data source is not obsolete. Indeed, it is the foundation for whatever objects the application is supporting.
Go to Top of Page

whitefang
Enterprise-Level Plonker Who's Not Wrong

272 Posts

Posted - 2009-05-06 : 15:38:17
You don't seem to understand the application life-cycle, design requirements, n-tier, or enterprise applications. When the application life-cycle is over, code isn't magically recreated from scratch. You reuse as much application code you can and implement new features/better techniques etc. If anything, you can re-use the same business logic layer depending on requirements. It's usually the front end that changes.

I've used Oracle, Mysql, Postgre, Sql, Toad, and other "SQL IDEs" and NONE of them compare to a IDE like VS. SQL "IDEs" (even Toad, the industry standard) are so primitive dinosaurs compared to a modern application IDE. Good luck debugging 1000 SPs and refactoring or implementing new changes.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-05-06 : 20:48:03
Can you clarify this statement:
quote:
You reuse as much application code you can and implement new features/better techniques etc. If anything, you can re-use the same business logic layer depending on requirements
With this one:
quote:
Good luck debugging 1000 SPs and refactoring or implementing new changes.
If you're reusing code, what are you refactoring? Certainly nothing in the data tier.
quote:
It's usually the front end that changes.
Again, if this is true, then what do you have to refactor?
quote:
You don't seem to understand the application life-cycle, design requirements, n-tier, or enterprise applications.
I certainly can't understand your definition of these things, which is utterly unique and different from any other definition of these terms.
quote:
I've used Oracle, Mysql, Postgre, Sql, Toad, and other "SQL IDEs" and NONE of them compare to a IDE like VS. SQL "IDEs" (even Toad, the industry standard) are so primitive dinosaurs compared to a modern application IDE.
What does the IDE have to do with application architecture, or n-tier, or enterprise anything? I understand you're a developer and that's what work in all day, but if you can only design databases in Visual Studio, please stop and ask someone else to do it for you. Using Visual Studio to design a database is like using a pickaxe for brain surgery.

I can only assume that all this bashing is due to your current environment, which is driving you crazy, and that you take it as a model for all development environments.
Go to Top of Page
   

- Advertisement -