select SortID,StatisticsID,StatisticsName,StatisticsUrl,Re from Sys_WFStatistics where StatisticsID in ( select StatisticsReports from Sys_Emplyee where EmpAccount='NEWSIGHT\zhangzhongsheng')
解决方案 »
- 简单的存储过程问题
- VB的Timer1事件每隔100毫秒从服务器数据库的TabA表中提数据刷新客户端界面上的MSHFlexGrid1控件。有24个客户端,TabA表中的记录由于各个客户端的操作而频繁变动,变动的范围为0~2000条左右记录,请审查这个方案是否可行。见主要代码:
- 未能建立与(local)的连接
- 关于SQL SERVER 服务器配置问题
- sql 语法错
- 非执行事务,报“访问接口 SQLNCLI 无法启动分布式事务“错误,请大家帮忙看一下
- 在安装sql server05的时候会自动创建出一些登陆用户作用
- sql2000 转 2005 注意事项
- 存储过程里的'set nocount on'是什么意思?
- 用SQL语句怎么实现查询到指定笔数的资料后就返回?
- 插入优化?
- 如何执行SQL脚本 ?在SQL中可以执行吗?
,StatisticsID
,StatisticsName
,StatisticsUrl
,Re
from Sys_WFStatistics
where exists (select 1
from Sys_Emplyee
where EmpAccount='NEWSIGHT\zhangzhongsheng'
and charindex(','+Convert(varchar,StatisticsID)+','
,
','+StatisticsReports+',')>0
)
select SortID,StatisticsID,StatisticsName,StatisticsUrl,Re from Sys_WFStatistics where StatisticsID in ( select cast(StatisticsReports as varchar) from Sys_Emplyee where EmpAccount='NEWSIGHT\zhangzhongsheng')
,StatisticsID
,StatisticsName
,StatisticsUrl
,Re
from Sys_WFStatistics
where exists (select 1
from Sys_Emplyee
where EmpAccount='NEWSIGHT\zhangzhongsheng'
and charindex(','''+Convert(varchar,StatisticsID)+''','
,
','''+StatisticsReports+''',')>0
)
(
StatisticsID ID,
SortID int default 0,
StatisticsName varchar(20) default '',
StatisticsUrl varchar(20) default '',
Re varchar(100) default ''
)create table Sys_Emplyee
(
StatisticsReports varchar(20),
EmpAccount varchar(100)
)
insert Sys_WFStatistics(StatisticsID)
select 1 union
select 2 union
select 3
insert Sys_Emplyee
select '''1'',''2'',''3''','NEWSIGHT\zhangzhongsheng'
go
--查询
select SortID
,StatisticsID
,StatisticsName
,StatisticsUrl
,Re
from Sys_WFStatistics
where exists (select 1
from Sys_Emplyee
where EmpAccount='NEWSIGHT\zhangzhongsheng'
and charindex(','''+Convert(varchar,StatisticsID)+''','
,
','''+StatisticsReports+''',')>0
)drop table Sys_WFStatistics,Sys_Emplyee
/*--结果
SortID StatisticsID StatisticsName StatisticsUrl Re
----------- ------------ -------------------- -------------------- -------
0 2 (1 row(s) affected)--*/
(
StatisticsID ID,
SortID int default 0,
StatisticsName varchar(20) default '',
StatisticsUrl varchar(20) default '',
Re varchar(100) default ''
)create table Sys_Emplyee
(
StatisticsReports varchar(20),
EmpAccount varchar(100)
)
insert Sys_WFStatistics(StatisticsID)
select 1 union
select 2 union
select 3
insert Sys_Emplyee
select '''1'',''2'',''3''','NEWSIGHT\zhangzhongsheng'
go
--查询
select SortID
,StatisticsID
,StatisticsName
,StatisticsUrl
,Re
from Sys_WFStatistics
where exists (select 1
from Sys_Emplyee
where EmpAccount='NEWSIGHT\zhangzhongsheng'
and charindex(','''+Convert(varchar,StatisticsID)+''','
,
','+StatisticsReports+',')>0
)drop table Sys_WFStatistics,Sys_Emplyee
/*--结果
SortID StatisticsID StatisticsName StatisticsUrl Re
----------- ------------ -------------------- -------------------- --------
0 1
0 2
0 3 (3 row(s) affected)--*/