Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 1.03 KB | None | 0 0
  1. alter procedure zad3a (@login varchar(30))
  2. as
  3. declare
  4. @tytul varchar (20),
  5. @imie varchar (30),
  6. @nazwisko varchar (30),
  7. @data_wypozyczenia date
  8.  
  9. IF @login IS  NULL OR @login != -1
  10.   begin
  11.     print 'Brakuje ci paramteru'
  12.   end
  13. else
  14.   begin
  15.  
  16.     declare kursor cursor for
  17.         select tytul, imie, nazwisko, dataWypozyczenia
  18.         from ksiazka
  19.         left outer join wypozyczenie on wypozyczenie.idKsiazka = ksiazka.IdKsiazka
  20.         left outer join klient on klient.IdKlient = wypozyczenie.idKlient
  21.     open kursor
  22.     fetch next from kursor into @tytul, @imie, @nazwisko, @data_wypozyczenia
  23.     WHILE @@FETCH_STATUS = 0
  24.       begin
  25.           if @data_wypozyczenia is null
  26.           print 'dupa'
  27.           else
  28.           print convert(varchar(15),@tytul) + '-' +convert(varchar(15),@imie) + '- '+ convert(varchar(15),@nazwisko) + '-' + convert(varchar(15),@data_wypozyczenia)
  29.           fetch next from kursor into @tytul, @imie, @nazwisko, @data_wypozyczenia
  30.       end
  31.     close kursor
  32.     deallocate kursor
  33.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement