|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Retrieve the 1st 15 words of a field
Hello,
i need a select statement that will retrieve only the 1st 15 words of a text field. is it possible? Thanks. |
|
#2
|
|||
|
|||
|
No, not possible. Your select statement can only pull the whole field. You'll have to use your server side scripting to parse out the first 15 characters. Such as:
varShortened = left(RS("thisField"), 15) |
|
#3
|
|||
|
|||
|
well not totally true. The select can pull out the 1st 15 chars from a field once it's in the table, but not from the text field that resides up front...it's up to your server script to get it to the dB first. fBraun, this may be more or less what you're getting @?
|
|
#4
|
|||
|
|||
|
I think i found a solution.
SELECT fieldID, Title LEFT(field, CHARINDEX(" ", field, 200)) It gets the 1st 200 caracters, and if it is not a space it goes until finding a space. Thanks for your reply |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Retrieve the 1st 15 words of a field |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|