开发者

Selecting part of text from sql database in asp.net

开发者 https://www.devze.com 2023-03-13 07:10 出处:网络
I have a nvarchar field in sql database .. for example I have 4000 character in this field but I want to select only 200 first character开发者_JS百科 and display in a label .

I have a nvarchar field in sql database .. for example I have 4000 character in this field but I want to select only 200 first character开发者_JS百科 and display in a label .

how can I do this ?


In the underlying query:

 SELECT 
   LEFT(fld, 200) 
 FROM T ...


Select Left(YourColumn, 200) as 'First200'
From dbo.YourTable

Or

Select SubString(YourColumn, 1, 200) as 'First200'
From dbo.YourTable

Information on Left and Substring

0

精彩评论

暂无评论...
验证码 换一张
取 消