SQL查询分析器外挂源码分享
本人写了一个SQL查询分析器扩展工具,功能类似Delphi的ToDo。可以方便开发者在大量的SQL脚本中快速找到每个模块、To-Do,从而提高开发高利率。
使用的时候先运行SQL查询分析器,然后运行本程序即可(可以工具|自定义中配置)。按F2显示To-Do List窗口,按Alt+F2在当前位置插入To-Do。
由于时间关系,本程序并未完善,在双击To-Do Item后应没有将光标定位到对应的位置,希望高手赐教,有兴趣的朋友不防继续完善它,并发一份源码给我。万分谢谢。(QQ:462400756)
{================================================================}
{ todo.dpr
{================================================================}
program todo;
{%ToDo 'todo.todo'}
uses
Forms,
windows,
messages,
tdmain in 'tdmain.pas' {frmToDoMain},
tdcontainer in 'tdcontainer.pas' {frmContainer},
tdItem in 'tdItem.pas' {frmItem},
tdFilter in 'tdFilter.pas' {frmFilter};
{$R *.res}
var
h: Hwnd;
begin
Application.Initialize;
h := FindWindow(nil, PChar('frmContainer'));
if h = 0 then
begin
Application.CreateForm(TfrmContainer, frmContainer);
Application.CreateForm(TfrmToDoMain, frmToDoMain);
Application.CreateForm(TfrmItem, frmItem);
Application.CreateForm(TfrmFilter, frmFilter);
Application.ShowMainForm := False;
end;
h := FindWindow(nil, PChar('frmContainer'));
SendMessage(h, WM_RERUN, 0, 0);
Application.Run;
end.
{================================================================}
{ tdmain.pas
{================================================================}
unit tdmain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, RegExpr, Tabs, Menus, StdCtrls, ImgList,
Grids, ExtCtrls;
type
TViewType = (vtTodo, vtModule);
TGroupType = (gtOwner, gtCategory);
TfrmToDoMain = class(TForm)
 
相关文档:
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--每页显示记录条数
@currentpage int output,--第几页
@orderid nvarchar(50),--主键排序
@sort int,--排序方式,1表示升序,0表示降序排列
......
作者:敖士伟
一张有group by后可能很多重复行,这时用not in等基于唯一列的分布算法会存在问题。
我的解决办法是:
一张表有一个id int的主键,对其它列进行group by,分页思想是:把max(id)做group by后的唯一列,还是用not in的分布思想。
例:
select top 4 sum(int_TZ2_id) as id,dt_TZ2_date,vchar_TZ2_Pin ......
写了一段例子,通过sql创建一个job,定期执行一些清除工作。在sql2005上测试通过。
sql帮助文档太零散了。这是一个完整的流程。不过注意定时执行时需要sql server agent服务器启动的。
USE msdb ;
GO
EXEC dbo.sp_add_job
@job_name = N'Clear oldest HB',
@enabled = 1,
@description = N'Clear heart ......
SELECT
count
(
userName
)
from
`userInfo`
GROUP
BY
userName
HAVING
count
(
userName
)
>
1。
这个Having一定要放在GROUP BY的后面。
而且很特殊的情况是在有group by的时候,是不能用到where子句的。而且Having子句一般是放在其他子句的后面的。
当我们选不只一个栏位,且其 ......
一、具有主键的情况
I.具有唯一性的字段id(为唯一主键)
delete 用户表
where id not in
(
select max(id) from 用户表 group by col1,col2,col3...
)
group by 子句后跟的字段就是你用来判断重复的条件,如只有col1,
那么只要col1字段内容相同即表示记录相同。
II. ......