Converting Datatypes

Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default Converting Datatypes

    Hi,

    I need to change a varchar field in my DB to a small date/time field. The
    problem is I don't want to lose the data, as I have quite a lot of records. Is
    there a way I can convert the varchar into a date?

    TIA

    Mattastic Guest

  2. Similar Questions and Discussions

    1. Complex DataTypes
      Ok, I created a Web Service using PHP5 SOAP extension. I created the WSDL and I can serve and consume that service in PHP. Now I am trying to...
    2. Service with 'shared' datatypes
      Hello NG, I need to write a factory where I be able to switch between webservice support and normal dll support. So I wrote a small test...
    3. sql=access=datatypes?
      What would be the corresponding data types for the following existing Access data types: Autonumber = (UniqueIdentifier?) Number =...
    4. complex datatypes and methods
      Hi, I created a custom container class in order to return values from web method calls and this works fine, but my problem is that I added some...
    5. Datatypes in Informix
      Hi, I am trying to obtain an extract of my Informix database into a formatted spreadsheet. The information of the fields in a table is...
  3. #2

    Default Re: Converting Datatypes

    Assuming all of the values in the column can be cast as the new type
    (datetime), most databases have a command that allows you to change a column's
    type. (ex. ALTER COLUMN ...) . If not, you should be able to add a new
    column, with the type "datetime", insert the values from the old column, drop
    the old column and rename the new column.

    Important - Always make a backup first before performing any changes!

    mxstu Guest

  4. #3

    Default Re: Converting Datatypes

    Hi, Thanks for that, I have 60 records need changing and I'm using SQl server, do you know the format to which I can key in the dates by hand?
    Mattastic Guest

  5. #4

    Default Re: Converting Datatypes

    Why key dates by hand? If the values are all in 'mm/dd/yyyy' format, just use ALTER TABLE ... ALTER COLUMN ...
    mxstu Guest

  6. #5

    Default Re: Converting Datatypes

    OK thanks, not sure how to do that though, can you do it in Enterprise Manager?
    Mattastic Guest

  7. #6

    Default Re: Converting Datatypes

    'ALTER TABLE ....' is a sql statement and would need to be executed through the query analyzer. If you're using the Enterprise Manager gui, I think you need to use the 'design table' option.
    mxstu 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