How to Set SQL Variables in Dynamic SQL Text

The following example shows how to use variables for input and output for execution of sql text.  This is handy for stored procedures that use sp_executesql for executing query text against a database.

-- Declare Input/Output Variables
Declare @vc_sql 		nvarchar(4000)	-- MUST BE NVARCHAR
	,@vc_input_Name  	varchar(200)
	,@sdt_output_BirthDay 	Smalldatetime

select @vc_sql = '
Select @sdt_output_BirthDay  = Employee.Birthday
From  dbo.Employee (NoLock)
where  Employee.Name >= ''@vc_input_Name'''

exec sp_executesql 	@vc_sql
			,N'@vc_input_Name varchar(200), @sdt_output_BirthDay Smalldatetime output'
			,@sdt_output_BirthDay out

TDD vs. Non TDD

Read an interesting article today comparing the time to develop something with and without TDD.

Here’s information for the lab:

Here’s a post with the results: