How to check if value is inserted successfully or not?

You can use @@ROWCOUNT server variable immediately after the insert query to check number of affected rows by the insert operation. declare @fName varchar(50) = ‘Abcd’, @lName varchar(50) = ‘Efgh’ INSERT INTO myTbl(fName,lName) values(@fName,@lName) PRINT @@ROWCOUNT –> 0- means no rows affected/nothing inserted –> 1- means your row has been inserted successfully For your requirement, … Read more

SQLite loop statements?

Apparently the looping construct in SQLite is the WITH RECURSIVE clause. That documentation link has sample count-to-ten code, a Mandelbrot set plotter, and a Sudoku puzzle solver, all in pure SQL. Here’s an SQLite query that computes the Fibonacci sequence to give you a feel for it: sqlite> WITH RECURSIVE …> fibo (curr, next) …> … Read more