View Full Version : SQL Length Question
Emancipator
07-17-2006, 05:11 PM
I am sure one of you sql gurus will know the answer to this. I want to check an sql field for its length and only select items which contain more then 800 characters. Here is hte code I am using that DOES NOT work :)
"SELECT * FROM monkey WHERE CHECK length(pet) > 800) ORDER BY views DESC";
I think your problem is you can't filter based on blob or memo fields, which I suspect your field "pet" is. Try creating a query that returns the length of "pet" for one record and see if you get a valid number. If you don't you'll know you can't use this method.
Emancipator
07-17-2006, 06:29 PM
can you give me a sample sql blurb ?
Chris
07-17-2006, 07:18 PM
select length(pet) as plength from table limit 1
Emancipator
07-18-2006, 05:37 AM
Ok so I got a value. Does anyone now know how I can do a check and only list those with a value greater then 800? IE more then 800 chars. Thanks guys. I should add the code that I pasted in my original post doesnt cause an error just doesnt work :)
Emancipator
07-18-2006, 06:04 AM
got it working thanks guys. It was a mixup in the sql and how i nested it.
Excellent news! BTW, which SQL database server are you using?
Emancipator
07-18-2006, 02:06 PM
thanks for the help KLB and Chris you helped me get on the right track. And KLB I have no clue :) I count on Nexcess for that stuff lol.
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.