易截截图软件、单文件、免安装、纯绿色、仅160KB

可为NULL 但不能重复的SQL约束


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER   trigger   [dbo].[checkExamNo] on   [dbo].[student]
  for   insert,update    as  
  if   exists(select   examNo from   student where   isnull(examNo ,'')<>''   group     by   examNo  having   count(*)>1   )  
  rollback


相关文档:

Orcale SQL优化

1.ORACLE采用自下而上的顺序解析WHERE子句,根据这个原理,表之间的连接必须写在其他WHERE条件之前, 那些可以过滤掉最大数量记录的条件必须写在WHERE子句的末尾. 
(低效) 
SELECT … from EMP E WHERE SAL > 50000 AND JOB = ‘MANAGER’ AND 25 < (SELECT COUNT(*) from EMP WHERE MGR=E. ......

一个多表嵌套查询的sql语句

select batch_no "批次号",get_id "分类" from (
select(
select plan1.batch_no from product_plan plan1 where plan1.item_no=(select head1.product_code from wo_head head1 where head1.order_no =bbb)) batch_no, 
(select decode(get_id,'BUY','外购件','MAK','自制件','MB','未定') from item where item_ ......

SQL Server连接远程数据源的基本方法

SQL Server连接远程数据源的基本方法有下面三种:
OPENDATASOURCE: The OPENDATASOURCE function is used to specify connection information for a remote data source by specifying the OLE DB provider and an initialization string. OPENDATASOURCE can be used directly within a SELECT, INSERT, UPDATE, or DELET ......

定期删除备份的SQL数据库的脚本

  比如某个数据库下对SQL SERVER的数据库进行了每天的备份,现在要保留7天以内的,其他的删除掉,用ASP可以实现了,但要用到filesystemobject,不大爽
    首先写一个js文件clearDatabaseBackup,内容如下
function deleteBackupFile(beforedays) {
    var fso = new ActiveXObject ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号