我试图查看标识列的值是否小于1.
IF (SELECT PKIdent FROM dbo.MyTable WHERE PKIdent < 1)
PRINT 'Its less than one'
答案 0 :(得分:1)
以下两种方法可以做到这一点:
IF ((SELECT min(PKIdent) FROM dbo.MyTable) < 1)
PRINT 'Its less than one'
或
IF exists (SELECT PKIdent FROM dbo.MyTable WHERE PKIdent < 1)
PRINT 'Its less than one'