Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default alter field type

    Hi Guys,
    I'm using SQL server 2000.

    How do I alter column/field from type int (with Identity = Yes Not For
    Replication) to just normail int field. No more identity. I want it to be done
    using SQL script( sql query analyzer).

    Please help me on this, thx

    Regards,
    Shaffiq

    capik79 Guest

  2. Similar Questions and Discussions

    1. Alter Table / Changing field types in SQL
      Hi Folks - I was wondering if anybody knows of some way to convert a field within a MS SQL table from varchar to Numeric. A table was set up...
    2. Problem with character palette and Tracking field: can't type zero after type is modified
      System: Illustrator CS, Panther 10.3.3 Try this: Create a few characters of type. Select some letters and change their tracking (Option + Command...
    3. Cast from type 'Field' to type 'String'
      Hi, Getting the above error - further info shown below Line 36: II2 = 0 Line 37: response.write ("var questions" & II & " = new Array();"...
    4. Changing image type to ntext via ALTER TABLE
      Hi Is there any way that we can change the data type of a column from 'image' type to 'ntext' via the ALTER TABLE command? Thanks
    5. text field that resizes as you type?
      > So could flash make a text box that is one line wide and one line high, then when you type it grows in height not Your advice would be very...
  3. #2

    Default Re: alter field type

    There is no way to directly remove the identity setting.

    You must store the column or the table to a temp table and then drop the
    original column or table and then rename the copy to the original name.

    Note that even when you change the table via Enterprise Manager (the only way
    sanctioned by Microsoft); this copy, drop, and rename process is what happens
    behind the scenes.

    The attached shows how to remove the identity feature from column iID of the
    table SOME_TABLE that has only one other column, sFoo.

    Be sure to back up your database before trying this!


    BEGIN TRANSACTION
    CREATE TABLE dbo.Tmp_SOME_TABLE
    (
    iID int NOT NULL,
    sFoo varchar(50) NOT NULL
    )
    GO

    IF EXISTS (SELECT * FROM dbo.SOME_TABLE)
    EXEC
    (
    'INSERT INTO dbo.Tmp_SOME_TABLE (iID, sFoo)
    SELECT iID, sFoo
    FROM dbo.SOME_TABLE TABLOCKX'
    )
    GO

    DROP TABLE dbo.SOME_TABLE
    GO

    EXECUTE sp_rename N'dbo.Tmp_SOME_TABLE', N'SOME_TABLE', 'OBJECT'
    GO
    COMMIT

    MikerRoo Guest

  4. #3

    Default Re: alter field type

    Hi MikerRoo,
    Thx for the solution. No wonder when i run alter command for column its not
    working. Even analyzer return success message but changes not successfull.
    Table still have an identity fields.
    Thanks for the solution.

    Regards,
    Shaffiq

    capik79 Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139