设置写入grant insert,update on 表 to username只能读不能写deny insert, update on 表 to username
grant select on 表 to username
grant select on 表 to username
解决方案 »
- 求一簡單sql
- 谁用过专业的工资条打印机?
- 一个复杂的查询语句,麻烦高手能帮忙解释一下,万分感谢
- 程序中执行SQL后,这些SQL会在那个系统表的那个字段中存放?
- SQL Server 2008 导入和导出包含空间数据类型(geography)字段的数据表时,不支持该类型会出现错误?
- 日期不间断查询(请高手帮忙)
- 在查询分析器里可用,但在作业里报错
- 请问:sql2000中能否根据表的主外键自动生成关系图?
- 一个对我很重要的问题 , 看谁的方法最好、最快 (300分)
- 在SQL SERVER中如何获取CPU序列号/磁盘序列号/网卡号
- 也许就是你的轻轻一指点,就能让我茅塞顿开啊!我的困惑,在线等!
- 急:ADO 事务 不能启动更多的事务??
建议使用触发器,你可以在触发器内进行时间判断时间,如果动作类型和时间设定有冲突
则进行回滚,或者使用Instead Of触发器。
for insert,update,delete
as
declare @d varchar(8)
set @d=convert(varchar(8),getdate(),108) --取得当前时间
if @d<'08:30:00' or @d>'17:00:00' --如果当前时间不在 08:30:00 至 17:00:00 之间,则取消对表的新增/修改/删除操作.
rollback tran
go
if @d<'08:30:00' or @d>'17:00:00'
不正确:
因为他是按字符的顺序排列的。9:01:00 不在8:01:00 和 17:00:00之间.
应该把它变为时间在排序。
请看:if (convert(varchar(8),getdate(),108) between '9:01:00' and '17:11:11' )
print 'yes'
else print 'no'
现在时间:9:35
结果: no
不合常理
CString szSQL;
szSQL.Format("SELECT * FROM %s WHERE BillID = '%s'", m_strTable, m_strBill);
try{
RMBillIDRecset rs(&m_RMBillDB);
if (!rs.Open(CRecordset::snapshot, szSQL) || rs.IsEOF()) { // Invalid binding
AfxMessageBox("无效的账号。");
rs.Close();
return ;
}
CString strLuo;
strLuo = "所查找的帐号为:";
strLuo += rs.m_BillID;
strLuo += "\n\r";
strLuo += "帐号的密码为:";
strLuo += rs.m_Password;
AfxMessageBox(strLuo);
rs.Close();
}
catch (CDBException *pdb) {
pdb->Delete();
AfxMessageBox( "数据库错误,请再试一次。");
}
if (convert(varchar(8),getdate(),108) between '09:01:00' and '17:11:11' )
print 'yes'
else print 'no'结果为"yes"
grant select on 表 to username