Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql server for loop

DECLARE @cnt INT = 0;

WHILE @cnt < cnt_total
BEGIN
   {...statements...}
   SET @cnt = @cnt + 1;
END;
Comment

Syntax of for-loop in SQL Server

--There is no for-loop, only the while-loop:

DECLARE @i int = 0

WHILE @i < 20
BEGIN
    SET @i = @i + 1
    /* do some work */
END
Comment

PREVIOUS NEXT
Code Example
Sql :: hour and minute between two datatime sql 
Sql :: show tables postgresql 
Sql :: oracle ORA-00054 origin 
Sql :: date 3 months from today sql 
Sql :: how to know password of mysql root in linux terminal 
Sql :: using distinct count in sqlite3 
Sql :: sql last 3 rows 
Sql :: reset identity column values in sql server 
Sql :: centos 8 install mysql 
Sql :: mysql data types 
Sql :: mysql tables max count 
Sql :: sql server format datetime 
Sql :: add unique constraint sql server multiple columns 
Sql :: sql like 
Sql :: oracle sysdate - 1 month 
Sql :: oracle alter table delete column 
Sql :: this is incompatible with sql_mode=only_full_group_by laravel 
Sql :: zsh: command not found: mysql mamp 
Sql :: sql select where in list 
Sql :: sql in sublime 
Sql :: sql where keyword contains 
Sql :: pl sql ptint 
Sql :: sql server pagination limit 
Sql :: mysql query to check record exists in database table or not 
Sql :: sql update table remove spaces 
Sql :: postgresql cast 
Sql :: foreign key mysql 
Sql :: how to import large sql file in phpmyadmin in ubuntu 
Sql :: update using case in mysql 
Sql :: postgres set column based on another column 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =