How to fetch just n-chars of a long text field...

Posts   
 
    
JayMan
User
Posts: 9
Joined: 02-May-2006
# Posted on: 15-May-2006 12:28:32   

Hi,

(I am not sure if this is the correct place to make a post of this nature. pardon me if it is not -kinda desperate.)

I was wondering how I could just fetch - say the first 100 characters from a text field that could potentially be many MBs long.

I want to be able to show the Title of the text and a preview of the attached text not more than 100 characters.

Thanks in advance, Jay

Platform: WinXP, LLBLGen Pro 1.0.2005.1 (March 2nd 2006), SQL Server 2005 Standard, VS.2005

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 15-May-2006 14:43:32   

From SQL Server Books Online: you need to use the SUBSTRING function.

USE Northwind
SELECT SUBSTRING(FirstName, 1, 1), LastName
FROM Employees
JayMan
User
Posts: 9
Joined: 02-May-2006
# Posted on: 16-May-2006 07:43:53   

Walaa wrote:

From SQL Server Books Online: you need to use the SUBSTRING function.

USE Northwind
SELECT SUBSTRING(FirstName, 1, 1), LastName
FROM Employees

Sorry, I probably did not make myself clear. I am aware of how it is done in SQL Server. But I wanted to know if I could use LLBLGen generated code and somehow filter the returned data to only fetch n-chars BEFORE it gets fetched from the db.

I did not want to use a SP to do it if I could help it.

Thanks in advance, Jay

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 16-May-2006 08:18:40   

Implement IExpression.

Please check the following thread for more details: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=3829