SQL有LEFT函数,在DELPHI中,这函数如何写?
解决方案 »
- ACTIVEX中的线程结束的回调函数不响应,怎么回事?
- fastreport 显示中文字段名
- 如何在调用一个程序时,让他在主程序的主窗口之内运行
- 关于无线MODEM的数据通讯问题
- 用image控件装入a.bmp,怎样改图片的宽为500相素后另存呢??
- Facon Server组件与进程,高手请!
- 高分求购web 打印控件?还有一个远程数据库,客户端打印问题帮忙解决一下
- 在数据库中新增记录的问题,急,请大家帮忙!!!QQ:16262688.
- TABLE表数据更新问题!绝对简单!
- 我现在要在datamodule中定义一个函数,用来在函数中控制不同的DBGrid,这个函数的形参是TDBGid类型吗
- 这是怎么回事
- 程序发布
function RightStr(const AText: string; const ACount: Integer): string;
function MidStr(const AText: string; const AStart, ACount: Integer): string;function LeftStr(const AText: string; const ACount: Integer): string;
begin
Result := Copy(AText, 1, ACount);
end;function RightStr(const AText: string; const ACount: Integer): string;
begin
Result := Copy(AText, Length(AText) + 1 - ACount, ACount);
end;function MidStr(const AText: string; const AStart, ACount: Integer): string;
begin
Result := Copy(AText, AStart, ACount);
end;
A. 对列使用 LEFT 函数
下面的示例返回每个书名最左边的 5 个字符。USE pubs
GO
SELECT LEFT(title, 5)
FROM titles
ORDER BY title_id
GO下面是结果集:-----
The B
Cooki
You C
Strai
Silic
The G
The P
But I
Secre
Net E
Compu
Is An
Life
Prolo
Emoti
Onion
Fifty
Sushi (18 row(s) affected)B. 对字符串使用 LEFT 函数
下面的示例使用 LEFT 函数返回字符串 abcdefg 最左边的 2 个字符。SELECT LEFT('abcdefg',2)
GO下面是结果集:--
ab (1 row(s) affected)