How to Restrict Duplidate Date Insert.

Posted by Jayakumars under ASP.NET on 11/12/2011 | Points: 10 | Views : 1342 | Status : [Member] [MVP] | Replies : 1
This is My Stored procedure

Create Proc [dbo].[Proc_IDays]
@Days1 varchar(30),
@FromD varchar(30),
@ToD varchar(30)
as
if not exists (Select Days1 from Tbl1 where Days1=@Days1 and FromD=@FromD and ToD=@ToD)
Insert into Tbl1 values(@Days1,@FromD,@ToD)

here i need how restrict Duplicate Date Insert fromDate and To date values
how to do this i need most urgent.

Mark as Answer if its helpful to you


Responses

Posted by: Blessyjees on: 11/14/2011 [Member] Bronze | Points: 25

Up
0
Down
hi,

Try this

Create Proc [dbo].[Proc_IDays]
@Days1 varchar(30),
@FromD varchar(30),
@ToD varchar(30)
as
if not exists (Select Days1 from Tbl1 where @FromID between FromD and ToD OR @ToD between FromD and ToD)
Insert into Tbl1 values(@Days1,@FromD,@ToD)



Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response