Я новичок в t-sql, и мне интересно, почему этот запрос выполняется так долго? Есть ли способ оптимизировать это ??
update aggregateflags set value=@value where objecttype=@objecttype and objectcode=@objectcode and storagetype=@storagetype and value != 2 and type=@type
IF @@ROWCOUNT=0
Select * from aggregateflags where objecttype=@objecttype and objectcode=@objectcode and storagetype=@storagetype and value = 2 and type=@type
IF @@ROWCOUNT=0
insert into aggregateflags (objectcode,objecttype,value,type,storagetype)
select @objectcode,@objecttype,@value,@type,@storagetype
@value int
@storagetype int
@type int
@objectcode nvarchar(100)
@objecttype int
Нет внешнего ключа.