Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Substring problem

Status
Not open for further replies.

whatsthehampton

Programmer
Sep 13, 2005
121
CA
Hi,

I am trying to select only the first 200 character from an NText field.

I read from sqlDennis that we should use 'substring'

Select SUBSTRING(fieldname,1,200) from tablename

This works but not when i need more than 1 field??

I have this
SELECT
substring(eventdesc,1,200), eventtitle, userid, eventid
FROM tbl_ecoevents

returns

'System.Data.DataRowView' does not contain a property with the name 'eventdesc'.


All help most appreciated
Cheers, J



 

Sounds like there is no EVENTDESC filed in the table, have you checked the spelling etc?



I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)
 
The problem here is that you are returning data (presumably to a front end application) but you are not specifying an alias for your column. Try adding the alias, like this...

Code:
[COLOR=blue]SELECT[/color]  
[COLOR=#FF00FF]substring[/color](eventdesc,1,200) [!]As EventDesc[/!], eventtitle, userid, eventid  
[COLOR=blue]FROM[/color] tbl_ecoevents

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top