可为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
相关文档:
1.ORACLE采用自下而上的顺序解析WHERE子句,根据这个原理,表之间的连接必须写在其他WHERE条件之前, 那些可以过滤掉最大数量记录的条件必须写在WHERE子句的末尾.
(低效)
SELECT … from EMP E WHERE SAL > 50000 AND JOB = ‘MANAGER’ AND 25 < (SELECT COUNT(*) from EMP WHERE MGR=E. ......
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_ ......
cpcbid cpcbbh type parentid parentbh cbze
70 2009120001 11 NULL NU ......
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数据库日志文件
/*--压缩数据库的通用存储过程
有两种方法 一是压缩日志,二是删除日志。
一、压缩日志及数据库文件大小
因为要对数据库进行分离处理
所以存储过程不能创建在被压缩的数据库中
/*--调用示例
exec p_compdb 'test'
--*/
use master --注意,此存储过程要建在master数据库中
go ......