Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
I want to Create a procedure for insert as in table have 7 weekdays such that suppose i have following fields mentioned below for the table as
 
Id  employeename   field1    field2   field3   field4
 
all fields are varchar data type
 
now condition should be that when i insert the record field1 value not equal to field2 so as for field1 not equal to field3 and field1 not equal to field4 and field2 not equal to field3 and field2 not equal to field4 and same for the field3 not equal to the field4
Posted 5-Feb-13 18:41pm
lalitkr1.5K
Edited 5-Feb-13 18:48pm
v2
Comments
naveensenagasetti at 5-Feb-13 23:50pm
   
Are You passing the values via page wise only....?
If you pass the values in page wise then check the condition using "if".
Ankur\m/ at 6-Feb-13 0:44am
   
There are many ways you can do that. 1) Check the condition in the stored proc/query you are using to insert the records to. Use RaiseError to throw error if a criteria is not met.
2) Another option is to use Instead Of trigger.
lalitkr at 6-Feb-13 1:59am
   
Pls provide me statement for the same if done by sql or asp.net
Ankur\m/ at 6-Feb-13 2:04am
   
Show me what you have tried.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Are You Passed the values via Page...?
 
If you pass the values via page then check the condition using "if".
 
if(field1!=field2 && field1!= field3 && field1 != field4 && field2 != field3 && field2 != field4 && field3!= field4)
{
// insert query
}
 
 
i'm not sure this is your expecting but as per my understanding i given this solution .
  Permalink  

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

  Print Answers RSS
0 Marcin Kozub 310
1 OriginalGriff 248
2 Sergey Alexandrovich Kryukov 215
3 Richard MacCutchan 202
4 Praneet Nadkar 197
0 OriginalGriff 8,048
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 6 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100