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. changing data types [modified]

changing data types [modified]

Scheduled Pinned Locked Moved Database
databasesql-serversysadminhelpquestion
6 Posts 2 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
    Saira Tanwir
    wrote on last edited by
    #1

    hi fellows, i want to change the data type of a table1(column1) that exists as a foreign key in table2(column2). i want to change the data type of column1(table1) but sql server gives the error that column2(table2) is dependent on column1(table1) so the data type cannot be changed. waht query should i use to ensure that when data type is changed of column1, then the data types of all the referencing columns in different tables should be changed? reply soon plz!!

    modified on Saturday, March 8, 2008 3:34 AM

    P 1 Reply Last reply
    0
    • S Saira Tanwir

      hi fellows, i want to change the data type of a table1(column1) that exists as a foreign key in table2(column2). i want to change the data type of column1(table1) but sql server gives the error that column2(table2) is dependent on column1(table1) so the data type cannot be changed. waht query should i use to ensure that when data type is changed of column1, then the data types of all the referencing columns in different tables should be changed? reply soon plz!!

      modified on Saturday, March 8, 2008 3:34 AM

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      Suspend referential integrity between the 2 tables, then make your changes.

      Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

      S 1 Reply Last reply
      0
      • P pmarfleet

        Suspend referential integrity between the 2 tables, then make your changes.

        Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

        S Offline
        S Offline
        Saira Tanwir
        wrote on last edited by
        #3

        how do i suspend refrential integrity constraint?

        P 1 Reply Last reply
        0
        • S Saira Tanwir

          how do i suspend refrential integrity constraint?

          P Offline
          P Offline
          pmarfleet
          wrote on last edited by
          #4

          Bring your table up in Design mode. From the 'Table Designer' menu select 'Relationships'. Set the 'Enforce Foreign Key Constraint' option to 'No'.

          Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

          S 1 Reply Last reply
          0
          • P pmarfleet

            Bring your table up in Design mode. From the 'Table Designer' menu select 'Relationships'. Set the 'Enforce Foreign Key Constraint' option to 'No'.

            Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

            S Offline
            S Offline
            Saira Tanwir
            wrote on last edited by
            #5

            how do i do it without opening sql server. i want to do it through my own coding

            P 1 Reply Last reply
            0
            • S Saira Tanwir

              how do i do it without opening sql server. i want to do it through my own coding

              P Offline
              P Offline
              pmarfleet
              wrote on last edited by
              #6

              Look at the ALTER TABLE[^] statement.

              Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

              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