I'm creating a view to get a substring of a column named ScopeContent in database X it has a datatype of ntext. When I'm looking at the value of ScopeContent in the view some of the data is null while others have data. For example, the first record has a datalength of 33000 but in the view that I created it shows as (NULL) and for the second record it has a datalength of 91578 and it shows the data in the view. Below is my sql statement.
If I understand correctly the way substring works is(column-name, starting position, length to)
CREATE VIEW ScopeContent2 (CatId, ScopeContent)
AS
SELECT CatId, SUBSTRING(ScopeContent,32001,32000) AS ScopeContent
FROM X
WHERE datalength(ScopeContent)>32000
For Example
CatId ScopeContent
----- ------------
1 (NULL)
2 rem ipsum dolor sit amet, consectetur adipiscing elit. Nam sed arcu posuere, pellentesque elit sit amet, ultricies mauris. Curabitur nec metus hendreri