Alter Table / Changing field types in SQL

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

  1. #1

    Default 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 with a field initially set to varchar(20). And I need to
    update the field type to Numeric.

    I use the following statement:

    alter table q_quotes_tbl
    alter column bound_premium numeric(20,2)

    And I get the following error message:
    Server: Msg 8114, Level 16, State 5, Line 1
    Error converting data type varchar to numeric.
    The statement has been terminated.

    Any and all help would be appreciated.

    Thanks,

    Doug

    Fordian-Slip Guest

  2. Similar Questions and Discussions

    1. 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...
    2. ASP Code to generate the schema of an SQL Table (field name, Data types , Size)
      Anyone has this SQL STATEMENT to traverse the User defined tables? I just need the Select Statement to get this info the rest I can handle. I...
    3. Quest Central allows you to alter ANYTHING in a table including column types
      I recently downloaded Quest Central for DB2....it's a life saver. I LOVE IT! IBM's Java tools are lacking and slow. Here's a quick list of some...
    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. alter table/tables
      UPDATE Cust SET CustID = (SELECT NewCustID FROM NewCust WHERE NewCust.CustID = Cust.CustID To generate a script that will update all the tables...
  3. #2

    Default Re: Alter Table / Changing field types in SQL

    If your db allows it,

    add a new column
    populate from the old column
    drop the old column
    rename the new one
    Dan Bracuk Guest

  4. #3

    Default Re: Alter Table / Changing field types in SQL

    Hi Dan -

    That's what I was thinking about doing if I couldn't get my Alter Table command to work properly.

    Thanks,

    Doug
    Fordian-Slip 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