Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
SQL
alter PROCEDURE SP_InsertUpdateSchoolSession
(
@Sessionid int,
@Schoolid	int,
@Session nvarchar(50),
@Sessionstrtdte nvarchar(50),
@Sessionenddte nvarchar(50),
@flag int
--@Status int output

)
AS
BEGIN
if(@flag=1)
begin
 if not exists (select 'X' from CreateSchSessions 
 where
  CONVERT(nvarchar(50), GETDATE(),103)>=SessionEnddate
   and SchoolId=@Schoolid and Status=1)  
begin
insert into CreateSchSessions(SchoolId,Session,SessionStartDte,SessionEnddate,Status)
values
(@Schoolid,@Session,@Sessionstrtdte,@Sessionenddte,1)
	select 'success' msg
end
else
begin 
select 'duplicate' msg 
end
end
if(@flag=2)
begin 
--   update
select 'update' msg

end 
if(@flag=3)
begin  
  ---update 
select 'delete' msg

end
end
Posted
Updated 2-Feb-14 7:23am
v2
Comments
Krunal Rohit 2-Feb-14 13:35pm    
not clear.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900