Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    Nov 2003
    Posts
    8

    Angry Unanswered: Cant get proper Field size using Enterprise Manager

    This is frustrating. Im new at MS SQL and have created a table using Enterprise Manager. I need one of the fields to hold a paragraph or page of text... Ive tried every data type and even those with max length of 8000 or greater, I cannot get it to save more than the first 256 characters. I use an "INSERT" or "UPDATE" command from a PHP script on the front end...

    any help would be amazing!

    thank you!

    michael wolff

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    have you thought that perhaps it is php that is not letting your text be longer then 256??

    if you are using sql to insert the record get php to print out the sql that it is sending to the server and then see what happens if you execute that in the query analyzer

  3. #3
    Join Date
    Nov 2003
    Posts
    8
    Originally posted by rokslide
    have you thought that perhaps it is php that is not letting your text be longer then 256??

    if you are using sql to insert the record get php to print out the sql that it is sending to the server and then see what happens if you execute that in the query analyzer

    the php shows the field as it should be... then i execute the INSERT... then missing text!

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    have you actually tried executing the sql in the query analyzer?

    I have been doing web based updates to sql for ages and I have only experienced this problem when I had stuffed up the command somewhere.

  5. #5
    Join Date
    Nov 2003
    Posts
    8
    you mean running the insert directly in EM to see if it takes the field size?

    no, but ill try it now!

  6. #6
    Join Date
    Nov 2003
    Posts
    8
    i tried it and got this:

    *********
    Server: Msg 103, Level 15, State 7, Line 1
    The identifier that starts with 'IN CASE YOU WERE WONDERING!! We've had some problems with our host and are currently working on fixing the problems this has cau' is too long. Maximum length is 128.
    Server: Msg 128, Level 15, State 1, Line 1
    The name 'IN CASE YOU WERE WONDERING!! We've had some problems with our host and are currently working on fixing the problems this has cau' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.
    ************

    its a 'VARCHAR' field of max length 8000... whys it telling me the max is 128 here? and whats it mean by "The nam"? its just text....

    *****

    heres the statement i ran:

    INSERT INTO headlines VALUES (getdate(),"IN CASE YOU WERE WONDERING!! We've had some problems with our host and are currently working on fixing the problems this has caused with the site. Just getting tour dates updated, BIG TEXTBIG TEXTBIG TEXTBIG TEXTBIG TEXTBIG TEXTBIG TEXTBIG TEXTBIG TEXTBIG TEXTBIG TEXT 25 BIG TEXTBIG TEXTBIG TEXTBIG TEXTBIG TEXTBIG TEXT 50 BIG TEXTBIG TEXTBIG TEXTBIG TEXTBIG TEXTBIG TEXT 100",25)



    field types are: datetime, varchar, numeric...

    and ideas???

    thank you.

    michael wolff

  7. #7
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    okie, well that error message is not coming from MS SQL. MS SQL would say something like - Action aborted. String or Binary data would have been truncated - or some such....

    can't remember the exact syntax....

    so something else is saying that the field is 128/256.

    in your php do you define the fields that you are putting data into? do they have default values for things like length??


    I have passed the error to a friend that uses php and will pass on what he says.

  8. #8
    Join Date
    Nov 2003
    Posts
    8
    dont need to define the fields.... well, its just a 'textarea' html field... and that value is passed into the 'INSERT' command...

    the errors i posted above i got directly from the Query Analyzer... so i dont know...

    please let me know what your friend says!

    thank you

    michael wolff

  9. #9
    Join Date
    Oct 2003
    Location
    Sweden
    Posts
    45
    Hi Michael,

    I wonder if it's not just a problem with your double quotes around the string.
    Could you try it with 'single quotes' (apostrophes?).
    SQL thinks you refer to a column or other database name if you put it within double quotes.

    Cheers,
    Robert

  10. #10
    Join Date
    Nov 2003
    Posts
    8
    still cut it off at 254 characters...... and this is directly with the QA.... so its the same results as doing it from a PHP script....

  11. #11
    Join Date
    Oct 2003
    Location
    Ireland
    Posts
    54
    Can you provide me with the script to create the table and the insert statement you're using and I'll take a look for you ?

    Thanks
    Mark

  12. #12
    Join Date
    Nov 2003
    Posts
    8
    i created the table directly in EM....

    but heres the INSERT code, pretty straighforward:

    $query="INSERT INTO headlines VALUES (getdate(),\"$newheadline\",\"$theid\")";

  13. #13
    Join Date
    Oct 2003
    Location
    Sweden
    Posts
    45
    Originally posted by celloshred
    i created the table directly in EM....
    You could right click the table in EM and choose All tasks->Generate SQL Scripts to get the script that would help us track down the problem.

    I guess this is not the case, but there was a limit in old ODBC drivers which cut off chars/varchars at 256 characters.

  14. #14
    Join Date
    Oct 2003
    Location
    Ireland
    Posts
    54
    you got there just before me :-)

  15. #15
    Join Date
    Nov 2003
    Posts
    8
    not sure what that is, but heres the file (attached)
    Attached Files Attached Files

Posting Permissions

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