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 :: string to date postgres 
Sql :: import sql file from laravel 
Sql :: get current date in pyspark sql 
Sql :: log queries postgre 
Sql :: sql script get all stored procedures from database 
Sql :: oracle list procedures 
Sql :: sql dateadd hours 
Sql :: show indexes in mql 
Sql :: postgres delete from where date is greater than specific date 
Sql :: wordpress sql find and replace 
Sql :: how to unlock table in mysql 
Sql :: postgres install unaccent extension 
Sql :: alter table engine mysql 
Sql :: oracle table statistics 
Sql :: get hour from date sql 
Sql :: start mysql server 
Sql :: sql select table header 
Sql :: sql server select top 2 of each group 
Sql :: key validation sql 
Sql :: sql server find all foreign keys that reference a column 
Sql :: add constraint fk 
Sql :: delete a view sql 
Sql :: mysql calculate age 
Sql :: postgres remove foreign key constraint 
Sql :: sql set auto increment back to 0 
Sql :: oracle list tablespaces 
Sql :: copy sql table 
Sql :: sql set no lmit 
Sql :: oracle db create new schema 
Sql :: select insert new table sql server 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =