Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts

    MS SQL Server, varchar only returns 255 chars

    I'm running a SQL Server with PHP (this host doesn't have mySQL) and I'm running into a problem with the varchar field.

    I've got a table with varchar(5000) (because SQL Server lets you do that ) because I want to be able to select DISTINCT resutls.

    SQL Server does not allow distinct to be used on a TEXT field, thus the varchar(5000).

    Now, when I query the results using mssql_fetch_assoc(), I only get the first 255 chars of that field.

    MY QUESTION:
    Is there any way to get the entire result back or is there a way in SQL server to select unique records from a TEXT field?

    Thanks

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,051
    Thanks
    10
    Thanked 94 Times in 92 Posts
    selecting distinct on a fieldset of that size would effectively kill your DB anyway ... better off when you add the data to the DB do a checksum ,eg

    <?php $check = MD5($text);?>

    and stick that in a seperate field for selecting distinct, your DB will love you for it I promise
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

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