Friday, 19 February 2016

insert data with check exist or not

   if not exists (select AssessmentName from AssessmentDetails where ClientID=43  and ProgramName='Accenture (BPO)' and CourseName='Effective Business Writing' and AssessmentName='test' )
                        BEGIN
                            insert into AssessmentDetails (ClientId,ProgramName,CourseName,AssessmentName,MaximumScore,CreatedBy,Status) values (
                              43,'Accenture (BPO)','Effective Business Writing','test','688',578,'True')
                              select 1 as p
                                end
                              else
                                BEGIN
                                select 0 as p
                                end

No comments:

Post a Comment