sql 分页语句
1. select top pageSize
* from table where id not in(select top((pageNo-1)*pageSize
) id from table order by id asc)
2. select * from table where id<=pageSize*pageNo
and id>(pageNo-1)*pageSize
order by id asc
注:
pagesize每页显示的记录数
pageNo当前第几页
相关文档:
select * from orders where month(orderdate)= (select month(orderdate) from orders where orderid=10248)
1.一个月第一天的
Select DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)
2.本周的星期一
Select DATEADD(wk, DATEDIFF(wk,0,getdate()), 0)
3.一年的第一天
Select DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)
......
搞了很久。。终于发现原来是权限问题。。
2行命令搞定
grant all privileges on rogue.* to admin@localhost identified by 'admin' with grant option
grant all privileges on rogue.* to admin@'%' identified by 'admin' with grant option
经典了。。。
魔力私服网页端搞定咯~~ ......
例1 传入一个参数@username,判断用户是否存在
-------------------------------------------------------------------------------
CREATE PROC IsExistUser
(
@username varchar(20),
@IsExistTheUser varchar(25) OUTPUT--输出参数
)
as
SELECT @IsExistTheUser = count(username)
from users
WHERE username ......
通配符 说明
_ 与任意单字符匹配
% 与包含一个或多个字符的字符串匹配
[ ] 与特定范围(例如,[a-f])或特定集(例如,[abcdef])中的任意单字符匹配。
[^] 与特定范围(例如,[^a-f])或特定集(例如,[^abcdef])之外的任意单字符匹配。
......
首先,用windows 身份验证 登陆 sql server 2005
依次展开
安全性->登录名
选中 sa 右键单击
选中 属性
弹出 sa 的属性对话框
就在密码处 改 密码 行了
改了密码后 用 sa 和 你改的密码登陆
如果还登陆不上
就是你没打开 sql server和 windows身份验证
和没授予 sa 登陆权限
解决办法如下
:::: ......