What are the different types of Storage Procedure?

Temporary Stored Procedures – SQL Server supports two types of temporary procedures: local and global. A local temporary procedure is visible only to the connection that created it. A global temporary procedure is available to all connections. Local temporary procedures are automatically dropped at the end of the current session…. Continue reading

Do stored procedures prevent SQL injection?

No, stored procedures do not prevent SQL injection. Here’s an actual example of a stored procedure that unfortunately permits SQL injection: CREATE PROCEDURE [dbo].[sp_colunmName2] @columnName as nvarchar(30), @type as nvarchar(30), @searchText as nvarchar(30) AS BEGIN DECLARE @SQLStatement NVARCHAR(4000) BEGIN SELECT @SQLStatement = ‘select * from Stations where ‘ + @columnName… Continue reading

What is User Defined Functions? What kind of User-Defined Functions can be created?

User-Defined Functions allow defining its own T-SQL functions that can accept 0 or more parameters and return a single scalar data value or a table data type. Different Kinds of User-Defined Functions created are: Scalar User-Defined Function: A Scalar user-defined function returns one of the scalar data types. Text, ntext,… Continue reading