SQL Datatypes
-
I want to define a custom datatype in SQL. I need it to be a structure that contains multiple fields. There is n't a struct datatype in SQL. How should I do this? Thanks. Steve Not all who wander are lost...
-
I want to define a custom datatype in SQL. I need it to be a structure that contains multiple fields. There is n't a struct datatype in SQL. How should I do this? Thanks. Steve Not all who wander are lost...
What database are you working with? SQL Server, Access, DB2 do not support what you are asking for exactly. SQL Server supports custom data types, but they are just simple types with pre-defined defaults and rules. Typically when working with a DB, you just flatten your strucutre into columns and deal with it like that. Object oriented databases and XML based databases do support the concept of a struct (or entity), but this only applies if you are working with one of these forms of DB.
-
What database are you working with? SQL Server, Access, DB2 do not support what you are asking for exactly. SQL Server supports custom data types, but they are just simple types with pre-defined defaults and rules. Typically when working with a DB, you just flatten your strucutre into columns and deal with it like that. Object oriented databases and XML based databases do support the concept of a struct (or entity), but this only applies if you are working with one of these forms of DB.
I am working with MS SQL Server 2000. I am developing a large app that has app based security. I was looking for a way to embed this info in the database. If worst comes to worst I will just have the same fields at the top of each table. Steve Not all who wander are lost...
-
I am working with MS SQL Server 2000. I am developing a large app that has app based security. I was looking for a way to embed this info in the database. If worst comes to worst I will just have the same fields at the top of each table. Steve Not all who wander are lost...
I don't know how your tables are layed out, but you might be able to have a single table for this info and have a 1:1 relationship between this table and the others. If you're tables aren't layed out easily, you could have an identity column in your strucutures table and add a column to each of your tables pointing to the identity column on the strucutues table. Another idea (just a thought, I've never done this) would be to use a blob or if possible a char field for the entire structure. If it can be easily represented as text you could just string it together (comma delimited, etc) and stuff it in a single column.
-
I am working with MS SQL Server 2000. I am developing a large app that has app based security. I was looking for a way to embed this info in the database. If worst comes to worst I will just have the same fields at the top of each table. Steve Not all who wander are lost...
One other thing... I would recommend against adding the same columns to a bunch of tables. I've done this exact thing in the past and it can be a nightmare to manage later. What happens when you need a new field in this structure? How many tables do you have to modify? Out of curisoty, what fields are in your structure?
-
I am working with MS SQL Server 2000. I am developing a large app that has app based security. I was looking for a way to embed this info in the database. If worst comes to worst I will just have the same fields at the top of each table. Steve Not all who wander are lost...
What About use, text fields, with any detereminated struct? Regards Carlos Antollini. www.wanakostudios.com Sonork ID 100.10529 cantollini