Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE FUNCTION zad44(@id int)
- returns varchar(50)
- as
- begin
- declare
- @ilo varchar(50),
- @imie varchar(50),
- @result varchar(MAX)
- set @ilo =(select count(*) from Wypozyczenia where IdKlienta=@id)
- set @imie =(select Imie from Klienci where IdKlienta=@id)
- set @result = CASE @ilo
- when 0 then 'Klient '+@imie+' nie wypozyczał jeszcze ksiazek'
- when 1 then 'Klient '+@imie+' Wypozyczal raz'
- else 'klient '+@imie+' wypozyczal juz '+@ilo+' razy'
- end
- return @result
- END;
- print dbo.zad44(2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement