Guest User

Untitled

a guest
Apr 13th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.51 KB | None | 0 0
  1. DECLARE @counter INT
  2. DECLARE @ilosc int
  3. DECLARE @prodNum varchar(20)
  4. SET @counter = 0
  5. WHILE @counter < 10  
  6.    BEGIN
  7.    SET @ilosc = (select FLOOR(RAND()*100))
  8.    SET @prodNum = (select TOP 1 ProduktNumer from Produkt Order by NEWID())
  9.    insert into Sprzedaz values(
  10.       (select TOP 1 KlientId from Klient Order by NEWID()),
  11.       (select @prodNum),
  12.       (select @ilosc),
  13.       ((select @ilosc)*(select TOP 1 Cena from Produkt where ProduktNumer = @prodNum)),
  14.       DEFAULT
  15.    )
  16.    SET @counter = @counter + 1
  17.    END
Add Comment
Please, Sign In to add comment