Search
 
SCRIPT & CODE EXAMPLE
 

SQL

while loop sql

/* while loop SQL Server */
DECLARE @Counter INT 
SET @Counter = 1
WHILE (@Counter <= 10)
BEGIN
    PRINT 'The counter value is = ' + CONVERT(VARCHAR, @Counter)
    SET @Counter = @Counter  + 1
END
Comment

while in sql server

WHILE (SELECT AVG(ListPrice) FROM Production.Product) < $300  
BEGIN  
   UPDATE Production.Product  
      SET ListPrice = ListPrice * 2  
   SELECT MAX(ListPrice) FROM Production.Product  
   IF (SELECT MAX(ListPrice) FROM Production.Product) > $500  
      BREAK  
   ELSE  
      CONTINUE  
END  
PRINT 'Too much for the market to bear';  
Comment

PREVIOUS NEXT
Code Example
Sql :: how to create triggers in sql server 
Sql :: sql count(*) 
Sql :: mysql replace regex 
Sql :: sql describe 
Sql :: isnull in sqlite 
Sql :: what data type to use for phone number in sql 
Sql :: sql table 
Sql :: missing left parenthesis error in sql 
Sql :: how to find sql server installation folder 
Sql :: not operator in sql 
Sql :: add sqlite3 in lumen 
Sql :: get specific column in mongodb 
Sql :: how to select from mssql 
Sql :: mssql replace first occurrence 
Sql :: create a plsql object 
Sql :: mysql check all tables 
Sql :: remove decimal in sql server 
Sql :: create temp table sql 
Sql :: mysql copy table rows from one database to another 
Sql :: offset in postgresql example 
Sql :: dump db only triggers mysql 
Sql :: max mysql 
Sql :: postgresql alter column data type from integer to integer array 
Sql :: postgres trim string 
Sql :: psql: error: FATAL: database "odoo" does not exist 
Sql :: sql date between one week 
Sql :: function plsql 
Sql :: end mysql command 
Sql :: oracle kill sessions script 
Sql :: t sql return on letters only 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =