问题是我有一个表Employee,其中有一个字段employeeAddress(varchar(200)),我在SQL Server中创建一个View EmployeeView,我想将它更改为employeeAddress(varchar(50)),意思是我想只显示employeeAddress列的50个字符,然后再与'...'连接。
例如: - 新德里(假设它是100个字符) 我想将其更改为EmployeeView
NewDel(假设它是50个字符)那么它应该是“NewDel ...”
答案 0 :(得分:1)
你可以试试这个
<div prefix="true">$</div>
答案 1 :(得分:1)
现有的大多数答案似乎都缺少对条件省略号的需求:
CREATE VIEW dbo.EmployeeView
WITH SCHEMABINDING
AS
SELECT
/* Other Columns */
CASE
WHEN LEN(EmployeeAddress) > 50
THEN SUBSTRING(EmployeeAddress,1,50) + '...'
ELSE EmployeeAddress
END as EmployeeAddress
FROM
dbo.Employee
答案 2 :(得分:0)
NSString *filePath = [NSString stringWithFormat:@"%@/Documents", NSHomeDirectory()];
NSString *imgPath = [NSString stringWithFormat:@"%@/%@.png", filePath, uniqueImgName];
[imgData writeToFile:imgPath atomically:YES];