可为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
相关文档:
废话不多说,上代码
SELECT k
from (
SELECT 'shanghai' AS k from DUAL
UNION ALL
SELECT 'dalian' AS k from DUAL
UNION ALL
SELECT 'beijing' AS k from DUAL
)
ORDER BY CASE
WHEN k = 'beijing'
......
很多时候,我们需要把数据库Sequence设置到某个特定的值开始,但是又不想重建这个Sequence 那下面的SQL语句就可以实现这样的功能: 其中user_seq是需要操作的Sequence名称,1 .. 100是递增100次 DECLARE
rowCount1 NUMBER;
BEGIN
FOR cc IN 1 .. 100
LOOP
SELECT user_seq.NEXTVAL INTO rowCount1 f ......
比如某个数据库下对SQL SERVER的数据库进行了每天的备份,现在要保留7天以内的,其他的删除掉,用ASP可以实现了,但要用到filesystemobject,不大爽
首先写一个js文件clearDatabaseBackup,内容如下
function deleteBackupFile(beforedays) {
var fso = new ActiveXObject ......