Professional Web Applications Themes

Changing image type to ntext via ALTER TABLE - Microsoft SQL / MS SQL Server

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...

Sponsored Links
  1. #1

    Default 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
    Sponsored Links
    dSQL Guest

  2. #2

    Default Re: Changing image type to ntext via ALTER TABLE

    No. It's well doented.


    --
    -oj
    RAC v2.2 & QALite!
    [url]http://www.rac4sql.net[/url]



    "dSQL" <daya_golwalawindowmaker.com> wrote in message
    news:6a5701c34771$af41fdc0$7d02280aphx.gbl...
    > 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

    oj Guest

  3. #3

    Default Re: Changing image type to ntext via ALTER TABLE

    Oops...here is the text from BOL:

    The altered column cannot be:

    a.. A column with a text, image, ntext, or timestamp data type.

    --
    -oj



    oj Guest

  4. #4

    Default Re: Changing image type to ntext via ALTER TABLE

    As oj pointed out you can't, but it is easy to do in a few steps:

    SELECT <primary_key>, image_column INTO #t FROM image_table
    ALTER TABLE image_table DROP COLUMN image_column
    ALTER TABLE image_table ADD image_column ntext NULL
    UPDATE image_table
    SET image_column = (SELECT image_column FROM #t
    WHERE #t.<primary_key> = image_table.<primary_key>)

    --
    Jacco Schalkwijk MCDBA, MCSD, MCSE
    Database Administrator
    Eurostop Ltd.


    "dSQL" <daya_golwalawindowmaker.com> wrote in message
    news:6a5701c34771$af41fdc0$7d02280aphx.gbl...
    > 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

    Jacco Schalkwijk Guest

Similar Threads

  1. alter field type
    By capik79 in forum Coldfusion Database Access
    Replies: 2
    Last Post: March 27th, 02:15 AM
  2. Alter Table / Changing field types in SQL
    By Fordian-Slip in forum Coldfusion Database Access
    Replies: 2
    Last Post: January 6th, 11:03 PM
  3. nothing retrieved from ntext data type?
    By Ray at in forum ASP Database
    Replies: 1
    Last Post: January 20th, 05:35 PM
  4. alter table/tables
    By Jacco Schalkwijk in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: July 11th, 08:41 AM
  5. Converting image type to ntext
    By dSQL in forum Microsoft SQL / MS SQL Server
    Replies: 0
    Last Post: July 11th, 05:51 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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