Friday, 9 December 2016

How to Use While LOOP in SQL

  1. DECLARE @TOTALV BIGINT  
  2. DECLARE @InitialValue BIGINT  
  3. SET @InitialValue=1  
  4. SET @TOTALV=12  
  5. WHILE (@InitialValue<=@TOTALV)  
  6. BEGIN  
  7. print @InitialValue  
  8. SET @InitialValue=@InitialValue+1  
  9. END  

No comments:

Post a Comment

SQL Server: Make all UPPER case to Proper Case/Title Case

CREATE FUNCTION [dbo].[fnConvert_TitleCase] (@InputString VARCHAR(4000) ) RETURNS VARCHAR(4000) AS BEGIN DECLARE @Index INT DECLARE @C...