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

TEXT datatype

Scheduled Pinned Locked Moved Database
questiondatabase
13 Posts 4 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.
  • Q Offline
    Q Offline
    quiteSmart
    wrote on last edited by
    #1

    What is the TEXT datatype? How should it be used? Is it good or bad? I have to save a long text to the database. I don't know the size that should be saved. Is it better to use the TEXT dataType or the VARCHAR datatype.

    C E 2 Replies Last reply
    0
    • Q quiteSmart

      What is the TEXT datatype? How should it be used? Is it good or bad? I have to save a long text to the database. I don't know the size that should be saved. Is it better to use the TEXT dataType or the VARCHAR datatype.

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      quiteSmart wrote:

      What is the TEXT datatype?

      A data type for storing text - up to 2Gb

      quiteSmart wrote:

      How should it be used?

      When you have large amounts of text to store

      quiteSmart wrote:

      Is it good or bad?

      Like anything it depends. If you pull the TEXT data out on each query whether it is required or not it is bad. If you are careful it is very good.

      quiteSmart wrote:

      I have to save a long text to the database. I don't know the size that should be saved. Is it better to use the TEXT dataType or the VARCHAR datatype.

      If the text data is going to be over 8K a TEXT data type is your only option.


      Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

      Q 1 Reply Last reply
      0
      • C Colin Angus Mackay

        quiteSmart wrote:

        What is the TEXT datatype?

        A data type for storing text - up to 2Gb

        quiteSmart wrote:

        How should it be used?

        When you have large amounts of text to store

        quiteSmart wrote:

        Is it good or bad?

        Like anything it depends. If you pull the TEXT data out on each query whether it is required or not it is bad. If you are careful it is very good.

        quiteSmart wrote:

        I have to save a long text to the database. I don't know the size that should be saved. Is it better to use the TEXT dataType or the VARCHAR datatype.

        If the text data is going to be over 8K a TEXT data type is your only option.


        Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

        Q Offline
        Q Offline
        quiteSmart
        wrote on last edited by
        #3

        i have read an article that says that i can use the VARCHAR to arround 2 billion characters. They say in this article that i should write the dataType like this: VARCHAR(max) i am trying it but it doesn't work. the link for the article is this:here One more question concerning the TEXT dataType, Does it have any problems concerning the storage capacity? or Is it like the varchar? meaning that it only takes the space it needs for saving not more? Thanks for the reply

        A C 2 Replies Last reply
        0
        • Q quiteSmart

          i have read an article that says that i can use the VARCHAR to arround 2 billion characters. They say in this article that i should write the dataType like this: VARCHAR(max) i am trying it but it doesn't work. the link for the article is this:here One more question concerning the TEXT dataType, Does it have any problems concerning the storage capacity? or Is it like the varchar? meaning that it only takes the space it needs for saving not more? Thanks for the reply

          A Offline
          A Offline
          andyharman
          wrote on last edited by
          #4

          Which version of SQL Server are you using?

          Q 1 Reply Last reply
          0
          • A andyharman

            Which version of SQL Server are you using?

            Q Offline
            Q Offline
            quiteSmart
            wrote on last edited by
            #5

            andyharman wrote:

            Which version of SQL Server are you using?

            Microsoft SQL Server Management Studio Express 9.00.2047.00

            C 1 Reply Last reply
            0
            • Q quiteSmart

              i have read an article that says that i can use the VARCHAR to arround 2 billion characters. They say in this article that i should write the dataType like this: VARCHAR(max) i am trying it but it doesn't work. the link for the article is this:here One more question concerning the TEXT dataType, Does it have any problems concerning the storage capacity? or Is it like the varchar? meaning that it only takes the space it needs for saving not more? Thanks for the reply

              C Offline
              C Offline
              Colin Angus Mackay
              wrote on last edited by
              #6

              quiteSmart wrote:

              i have read an article that says that i can use the VARCHAR to arround 2 billion characters.

              If you are using SQL Server 2005 (I forgot about that - I'm not yet using SQL Server 2005)


              Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

              1 Reply Last reply
              0
              • Q quiteSmart

                andyharman wrote:

                Which version of SQL Server are you using?

                Microsoft SQL Server Management Studio Express 9.00.2047.00

                C Offline
                C Offline
                Colin Angus Mackay
                wrote on last edited by
                #7

                quiteSmart wrote:

                Microsoft SQL Server Management Studio Express 9.00.2047.00

                That is the IDE, not the version of the database engine. If you are using this IDE and it is the only version of SQL Server you have installed then you are using SQL Server 2005


                Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

                Q 1 Reply Last reply
                0
                • C Colin Angus Mackay

                  quiteSmart wrote:

                  Microsoft SQL Server Management Studio Express 9.00.2047.00

                  That is the IDE, not the version of the database engine. If you are using this IDE and it is the only version of SQL Server you have installed then you are using SQL Server 2005


                  Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

                  Q Offline
                  Q Offline
                  quiteSmart
                  wrote on last edited by
                  #8

                  yes it is SQL 2005

                  A 1 Reply Last reply
                  0
                  • Q quiteSmart

                    yes it is SQL 2005

                    A Offline
                    A Offline
                    andyharman
                    wrote on last edited by
                    #9

                    I don't have access to SQL-Server 2005 from this machine, but you should be able to create tables like:

                    create table MyTable(
                      Id int identity(1,1) not null,
                      MyBigColumn varchar(max) null
                      )
                    

                    I believe that Microsoft are recommending use of "varchar(max)" instead of the "text" data-type. Regards Andy

                    Q 1 Reply Last reply
                    0
                    • A andyharman

                      I don't have access to SQL-Server 2005 from this machine, but you should be able to create tables like:

                      create table MyTable(
                        Id int identity(1,1) not null,
                        MyBigColumn varchar(max) null
                        )
                      

                      I believe that Microsoft are recommending use of "varchar(max)" instead of the "text" data-type. Regards Andy

                      Q Offline
                      Q Offline
                      quiteSmart
                      wrote on last edited by
                      #10

                      andyharman wrote:

                      MyBigColumn varchar(max) null

                      I read on MSDN that i can do this, but when trying it; it doesn't work i don't have any clue why that is happening

                      A 1 Reply Last reply
                      0
                      • Q quiteSmart

                        andyharman wrote:

                        MyBigColumn varchar(max) null

                        I read on MSDN that i can do this, but when trying it; it doesn't work i don't have any clue why that is happening

                        A Offline
                        A Offline
                        andyharman
                        wrote on last edited by
                        #11

                        What error message do you get?

                        Q 1 Reply Last reply
                        0
                        • A andyharman

                          What error message do you get?

                          Q Offline
                          Q Offline
                          quiteSmart
                          wrote on last edited by
                          #12

                          andyharman wrote:

                          What error message do you get?

                          Syntax Error newr 'max'

                          1 Reply Last reply
                          0
                          • Q quiteSmart

                            What is the TEXT datatype? How should it be used? Is it good or bad? I have to save a long text to the database. I don't know the size that should be saved. Is it better to use the TEXT dataType or the VARCHAR datatype.

                            E Offline
                            E Offline
                            Ennis Ray Lynch Jr
                            wrote on last edited by
                            #13

                            BLOB data is stored separately from the record in the underlying data structure by the RDBMS


                            File Not Found

                            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