"INSERT INTO kpicolor(KPIName, MinVal, MaxVal, ColorVal, Markersize, UserSession) " +
"SELECT * FROM(SELECT @KPIName, @MinVal, @MaxVal, @ColorVal, @Markersize, @UserSession) AS tmp WHERE NOT EXISTS " +
"(Select KPIName from kpicolor where @MinVal between MinVal And MaxVal And KPIName = @KPIName AND UserSession='" + userSession + "'); ";
if i am adding 1 to 50 it is restricting between numbers. if i add 51 to 100 it is appending the row. after that i am inserting 101 to above numbers it unable to insert. but if add from 52 to 150 it adding again. please help me out this sql query