HI all,
following is working code
create procedure [dbo].[Sp_addbusdetails]
@bus_id nvarchar(50),
@tour_date nvarchar(50),
@tour_id nvarchar(50),
--tour_date,bus_id,source,destination,fare,status
@bookby nvarchar(50),
@source nvarchar(50),
@destination nvarchar(50),
@fare nvarchar(50),
@status nvarchar(50),
@book_date nvarchar(50),
@advance nvarchar(50),
@balance nvarchar(50),
@tourtype nvarchar(50),
@startid nvarchar(50),
@ndays int
as
declare @count int
if(ndays =0)
begin
select @count=COUNT(*) from Busdetails where tour_date=@tour_date and bus_id=@bus_id
if @count=0
begin
insert into busdetails(tour_id,tour_date,bus_id,bookby,source,destination,fare,status,book_date,advance,balance,tourtype,startid,ndays) values(@tour_id,@tour_date,@bus_id,@bookby,@source,@destination,@fare,@status,@book_date,@advance,@balance,@tourtype,@startid,@ndays)
end
else
begin
end
My requirement is in the else condition i want to add multiple records suppose ndays =3 and tour_id=100-20-may-2014,then i want to add records with
tour_id=100-20-may-2014,100-21-may-2014,100-22-may-2014 how it is possible
Regards
Baiju