Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL Datatypes

SQL Datatypes

Scheduled Pinned Locked Moved Database
databasequestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Steve Severance
    wrote on last edited by
    #1

    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...

    M 1 Reply Last reply
    0
    • S Steve Severance

      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...

      M Offline
      M Offline
      Matt Gullett
      wrote on last edited by
      #2

      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.

      S 1 Reply Last reply
      0
      • M Matt Gullett

        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.

        S Offline
        S Offline
        Steve Severance
        wrote on last edited by
        #3

        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...

        M C 3 Replies Last reply
        0
        • S Steve Severance

          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...

          M Offline
          M Offline
          Matt Gullett
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • S Steve Severance

            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...

            M Offline
            M Offline
            Matt Gullett
            wrote on last edited by
            #5

            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?

            1 Reply Last reply
            0
            • S Steve Severance

              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...

              C Offline
              C Offline
              Carlos Antollini
              wrote on last edited by
              #6

              What About use, text fields, with any detereminated struct? Regards Carlos Antollini. www.wanakostudios.com Sonork ID 100.10529 cantollini

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups