Results 1 to 11 of 11
  1. #1
    Join Date
    Mar 2003
    Location
    Memphis, TN, USA
    Posts
    61

    Post Unanswered: Text datatype issue

    Hi there !
    Can anyone let me know, how to store and retrive the text datatype field value in SQL Server 2000 ?

    I need to store 1500-2000 character at once, so for that i created textarea tag in html page and made the table field datatype for that textarea is text. What is happening in the table is... all fields value gets uploaded except that Textarea field one ? Why ??

    Are there some else way to store the data into it ? Please guide me... I am making the webpages in ASP and SQL SERVER 2000.

  2. #2
    Join Date
    Dec 2003
    Posts
    454
    Please read the post at
    http://www.dbforums.com/showthread.php?threadid=976872

    Do not use TEXT data type if you can use VARCHAR data type instead. VARCHAR can hold maximun to 8000 characters.

  3. #3
    Join Date
    Feb 2002
    Posts
    2,232
    I agree - from your description you should use a varchar. Using text is a last straw scenario because of performance issues and special handling that is required.
    If you do not have SQL Server Books Online (BOL) installed - please do so. The majority of questions asked in the SQL Server forum could be eliminated if people had access to bol. BOL

  4. #4
    Join Date
    Mar 2003
    Location
    Memphis, TN, USA
    Posts
    61
    Hey.. Thanks for the link and lovely suggestion.

    I went for it and replaced Text datatype with field datatype. But .. problem remain the same..

    Not able to insert a single character in the respective field ? How come ??

  5. #5
    Join Date
    Feb 2002
    Posts
    2,232
    You replaced the text datatype with which datatype - did you mean varchar(2500) or whatever your max length is for that field ? List the elements of your table - column name and datatype.
    If you do not have SQL Server Books Online (BOL) installed - please do so. The majority of questions asked in the SQL Server forum could be eliminated if people had access to bol. BOL

  6. #6
    Join Date
    Dec 2003
    Posts
    454
    What is the data type of the field now? Post your code for your insertion of data.

  7. #7
    Join Date
    Mar 2003
    Location
    Memphis, TN, USA
    Posts
    61
    FYI...

    CREATE TABLE [event] (
    [eventid] [int] IDENTITY (1, 1) NOT NULL ,
    [evename] [varchar] (50) NOT NULL,
    [evedesc] [varchar] (2000) NOT NULL ,
    [evetype] [varchar] (50) NULL
    )

    ASP Code ::

    Dim Conn, Rec, Strsql
    Set Conn = Server.CreateObject("ADODB.Connection")
    Set Rec = Server.CreateObject("ADODB.Recordset")
    Conn.Open "DSN=abc;UID=sqlboy;PWD=abc;DATABASE=abc"
    Strsql ="Insert into event values('"& Request.Form("Name" ) &"','"& Request.Form("Descript" ) &"','"& Request.Form("Type" ) &"')"
    Set Rec = Conn.Execute(Strsql)

  8. #8
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Is the rest of the record inserted?? If so I would suspect the your request for Desc is wrong (eg returning null or "").

    To test if this is the case replace your requests with hard coded values and see what happens.

    Additionaly have you tried putting values into the field using the QA or EM?

  9. #9
    Join Date
    Mar 2003
    Location
    Memphis, TN, USA
    Posts
    61
    Thanks to all of you..

    I really did veryvery silly mistakes.. The request for description field is wrong. I forgot to put 's' in the insert statement. The request for evedesc table field is 'Descripts' not 'Descript'

    Problem sorted out now.

    Thanking you all for your anticipation.

  10. #10
    Join Date
    Dec 2003
    Posts
    454
    If you use

    <% Set Rec = Conn.Execute(Strsql) %>

    you do not need

    <% Set Rec = Server.CreateObject("ADODB.Recordset") %>

  11. #11
    Join Date
    Mar 2003
    Location
    Memphis, TN, USA
    Posts
    61
    Thanks for the suggestion guyan !

    Being a kid of Microsoft world, i not aware about the basic fundamental. Why the following syntax used and what actually it did ?? I am in learning stage of ASP and SQL but want to learn everything of the packages.

    Thanks indeed !

Posting Permissions

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