MVP, Author

What is @@ERROR?

Hits: 27

The @@ERROR automatic variable returns the error code of the last Transact-SQL statement.

If there was no error, @@ERROR returns zero.

Because @@ERROR is reset after each Transact-SQL statement, it must be saved to a variable if it is needed to process it further after checking it.

Can a stored procedure call itself or recursive stored procedure? How many level SP nesting possible?

Hits: 63

Yes,Because Transact-SQL supports recursion, you can write stored procedures that call themselves. Recursion can be defined as a method of problem solving wherein the solution is arrived at by repetitively applying it to subsets of the problem.

A common application of recursive logic is to perform numeric computations that lend themselves to repetitive evaluation by the same processing steps. Stored procedures are nested when one stored procedure calls another or executes managed code by referencing a CLR routine, type, or aggregate. You can nest stored procedures and managed code references up to 32 levels.

What is SQL server agent?

Hits: 29

SQL Server agent plays an important role in the day-to-day tasks of a database administrator (DBA).

It is often overlooked as one of the main tools for SQL Server management. Its purpose is to ease the implementation of tasks for the DBA, with its full-function scheduling engine, which allows you to schedule your own jobs and scripts.