日期:2014-05-18 浏览次数:20657 次
declare @i varchar(10)='002' if exists(select 1 from tb where beginno<@i and endno>@i) print '@i 已经存在
------解决方案--------------------
declare @a varchar(3)
set @a='002'
if exists (select 1 from tb where @a >beginno and @a<endno)
print '该数据已经存在了'
else
insert into tb ......