

select * from Kupac

create or alter proc blabla
@Ime nvarchar(50),
@Prezime nvarchar(50),
@email nvarchar(50),
@Telefon nvarchar(25),
@Poruk nvarchar(50) output
as
declare @IDKupac int
select @IDKupac=IDKupac from Kupac where @Ime=Ime and @Prezime=Prezime
if @IDKupac is null begin insert into Kupac(Ime, Prezime,Email,Telefon) values(@Ime, @Prezime, @email, @Telefon)  set @IDKupac=SCOPE_IDENTITY() end
set @Poruk='Kupac ID: <'+cast(@IDKupac as nvarchar(50))+'>'

declare @P nvarchar(50)
exec blabla 'Ma', 'ma','ma@ma', '010', @P output
print @P

drop proc blabla



create or alter proc blabla
@Ime nvarchar(50),
@Prezime nvarchar(50),
@email nvarchar(50),
@Telefon nvarchar(25),
@Poruk nvarchar(50) output
as
declare @IDKupac int
select @IDKupac=IDKupac from Kupac where @Ime=Ime and @Prezime=Prezime
if @IDKupac is not null begin print 'Kupac ID: <'+cast(@IDKupac as nvarchar(50))+'>' end else begin insert into Kupac(Ime, Prezime,Email,Telefon) values(@Ime, @Prezime, @email, @Telefon)  set @IDKupac=SCOPE_IDENTITY() print 'Kupac ID: <'+cast(@IDKupac as nvarchar(50))+'>' end

declare @P nvarchar(50)
exec blabla 'Ma', 'ma','ma@ma', '010', @P output
print @P

drop proc blabla