I have the following Stored Procedure :
ALTER PROCEDURE [dbo].[ProcedureName]
@date NVARCHAR(50)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @result nvarchar(500) -- this one should return string.
DECLARE @variable1 NVARCHAR(50)
set @variable1 = (SELECT COUNT(*) FROM dbo.Table1 WHERE column1 not in (select column1 from dbo.Table2))
DECLARE @variable2 NVARCHAR(50)
update dbo.Table1 set columnX = 1 where column1 not in (select column1 from dbo.Table2)
set @variable2 = @@ROWCOUNT
Run Code Online (Sandbox Code Playgroud)
and so on... it continues like 200 rows of script with at least 10-12 variables …