The syntax for the FOR Loop is: FOR loop_counter IN [REVERSE] lowest_number..highest_number LOOP {.statements.} END LOOP; You would use a FOR Loop when you want to execute the loop body a fixed number of times. Let’s take a look at an example. FOR Lcntr IN 1..20 LOOP LCalc := Lcntr * 31; END … Continue reading
How do set variable and set value variable in MsSQL Server Stored Procodure? let’go to these example : USE [dbname] GO /****** Object: StoredProcedure [dbo].[sp_importCust] Script Date: 12/01/2011 22:30:33 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER Procedure [dbo].[sp_importCust] @parSessionID VARCHAR(16) AS DECLARE @cif varchar(255), @cust_name varchar(255), @join_date varchar, @sales_code varchar(255), @sales_name varchar(255), … Continue reading