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. General Programming
  3. C#
  4. Using smo????

Using smo????

Scheduled Pinned Locked Moved C#
databasequestion
10 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.
  • O Offline
    O Offline
    omegazafer
    wrote on last edited by
    #1

    Hi, How can I reach database relation diagram of sql by using smo? I want to learn parent key table of any column if that column is foreign key. Forexample, in northwind database, in products table, there is categoryid column. This column is related to id in Category table. I want to find this. Best Regards THANKS

    L A 2 Replies Last reply
    0
    • O omegazafer

      Hi, How can I reach database relation diagram of sql by using smo? I want to learn parent key table of any column if that column is foreign key. Forexample, in northwind database, in products table, there is categoryid column. This column is related to id in Category table. I want to find this. Best Regards THANKS

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      omegazafer wrote:

      How can I reach database relation diagram of sql by using smo?

      Not possible.

      omegazafer wrote:

      I want to learn parent key table of any column if that column is foreign key.

      Very possible :) You do not need SMO for this. Look at calling one or both of the following stored procedures: sp_foreignkeys sp_primarykeys

      xacc.ide - now with TabsToSpaces support
      IronScheme - 1.0 alpha 4a out now (29 May 2008)

      O 1 Reply Last reply
      0
      • O omegazafer

        Hi, How can I reach database relation diagram of sql by using smo? I want to learn parent key table of any column if that column is foreign key. Forexample, in northwind database, in products table, there is categoryid column. This column is related to id in Category table. I want to find this. Best Regards THANKS

        A Offline
        A Offline
        Ashfield
        wrote on last edited by
        #3

        omegazafer wrote:

        How can I reach database relation diagram of sql by using smo

        You can't, and you don't need to. Have a look at my article aboutr smo, it should put you on the right track to get the details you want - although there are also non-smo methods. http://www.codeproject.com/KB/cs/smo.aspx[^]

        Bob Ashfield Consultants Ltd

        O 1 Reply Last reply
        0
        • L leppie

          omegazafer wrote:

          How can I reach database relation diagram of sql by using smo?

          Not possible.

          omegazafer wrote:

          I want to learn parent key table of any column if that column is foreign key.

          Very possible :) You do not need SMO for this. Look at calling one or both of the following stored procedures: sp_foreignkeys sp_primarykeys

          xacc.ide - now with TabsToSpaces support
          IronScheme - 1.0 alpha 4a out now (29 May 2008)

          O Offline
          O Offline
          omegazafer
          wrote on last edited by
          #4

          Thanks, But I don't need only foreign key or primary key columns. The table that the column ,which is foreign key , is related. For example, I search the categoryId column for this in Product table. The result wanted is Category table.(I mention on NorthWind Database) Best Regards

          L 1 Reply Last reply
          0
          • A Ashfield

            omegazafer wrote:

            How can I reach database relation diagram of sql by using smo

            You can't, and you don't need to. Have a look at my article aboutr smo, it should put you on the right track to get the details you want - although there are also non-smo methods. http://www.codeproject.com/KB/cs/smo.aspx[^]

            Bob Ashfield Consultants Ltd

            O Offline
            O Offline
            omegazafer
            wrote on last edited by
            #5

            Thanks for you reply, I looked at your article but I didn't understand. Can you explain a little more? Have a good day

            A 1 Reply Last reply
            0
            • O omegazafer

              Thanks, But I don't need only foreign key or primary key columns. The table that the column ,which is foreign key , is related. For example, I search the categoryId column for this in Product table. The result wanted is Category table.(I mention on NorthWind Database) Best Regards

              L Offline
              L Offline
              leppie
              wrote on last edited by
              #6

              Did you read the docs on those 2 store procedures? :sigh:

              xacc.ide - now with TabsToSpaces support
              IronScheme - 1.0 alpha 4a out now (29 May 2008)

              O 1 Reply Last reply
              0
              • O omegazafer

                Thanks for you reply, I looked at your article but I didn't understand. Can you explain a little more? Have a good day

                A Offline
                A Offline
                Ashfield
                wrote on last edited by
                #7

                Well, its only meant to be an introduction, giving you an idea of what smo can do. Try Googling EnumForeignKeys, it will give you waht you are looking for I think

                Bob Ashfield Consultants Ltd

                O 1 Reply Last reply
                0
                • L leppie

                  Did you read the docs on those 2 store procedures? :sigh:

                  xacc.ide - now with TabsToSpaces support
                  IronScheme - 1.0 alpha 4a out now (29 May 2008)

                  O Offline
                  O Offline
                  omegazafer
                  wrote on last edited by
                  #8

                  Sp_foreign keys gives only foreign key column . I don't need only these as I said before. If it is possible , can you reply my sample question ? Have a good day Kemal Akkanat

                  L 1 Reply Last reply
                  0
                  • O omegazafer

                    Sp_foreign keys gives only foreign key column . I don't need only these as I said before. If it is possible , can you reply my sample question ? Have a good day Kemal Akkanat

                    L Offline
                    L Offline
                    leppie
                    wrote on last edited by
                    #9

                    Look at the source of this article[^]. I wrote it many many years back, and AFAIK I used those procs. You can get all the info you need.

                    xacc.ide - now with TabsToSpaces support
                    IronScheme - 1.0 alpha 4a out now (29 May 2008)

                    1 Reply Last reply
                    0
                    • A Ashfield

                      Well, its only meant to be an introduction, giving you an idea of what smo can do. Try Googling EnumForeignKeys, it will give you waht you are looking for I think

                      Bob Ashfield Consultants Ltd

                      O Offline
                      O Offline
                      omegazafer
                      wrote on last edited by
                      #10

                      Thanks.

                      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