Results 1 to 3 of 3

Thread: Populating Matrix Table

  1. #1
    Join Date
    Jun 2005
    Posts
    14

    Populating Matrix Table

    Hi,

    I need to populate a table with a matrix of Y and N values.
    i.e.

    TABLE A
    (COL1 CHAR(1),
    COL2 CHAR(1),
    COL3 CHAR(1),
    COL4 CHAR(1)
    )

    The values would be

    COL1 COL2 COL3 COL4
    row 1 Y Y Y Y
    row 2 N Y Y Y
    row 3 N N Y Y
    ....

    The idea is that there would be a row for each possible combination of Y and N values.

    Does anyone have some suggestions on how I would populate this via a SQL Stored Procedure?

    Thanks

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    You can use a loop to go through 1 to 16, get 4 bit binary value of the number and parse each bit for Y and N. Then insert into table.

  3. #3
    Join Date
    Jun 2005
    Posts
    14
    Thanks skhanal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •