|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Cannot ORDER BY on certain field types
I have an ASP page that I'm using to display a recordset and allow users to sort on column headers (field names). However, I keep getting the message "... The text, ntext, and image data types cannot be used in an ORDER BY clause" even when I have changed the field type to char, nchar, or nvarchar. I take it these are identical to text, ntext but just named differently? There has to be a way to sort by fields containing text -- any suggestions? Thank you!
|
|
#2
|
||||
|
||||
|
You must Cast or Convert them to another type, so you can order them.
You can cast them as varchar(?), then order them. |
|
#3
|
|||
|
|||
|
Ok - I did a convert(varchar(n), fieldName) on the fields in question ... I no longer get the error message, but my sorting doesn't work any better ... one thing at a time I guess! Thanks for your help!
|
|
#4
|
|||
|
|||
|
Stupid me -- the redirect was still pointing to the test page rather than the live page (which I was being lazy and testing on). So, the sorting actually worked, but I was being punished for being sloppy.
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Cannot ORDER BY on certain field types |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|