Click here to Skip to main content
15,906,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
sir m having a form in which there a many fields there are some mandatory and some non mandatory fields ..i want to write a Sql query to accept only mandatory fields and non mandatory fields should be optional...pls help with some example

thanks in advance
(Rajendra)
Posted
Comments
[no name] 15-Sep-12 12:26pm    
An example for what? What have you tried?
Raj.Rautela 15-Sep-12 13:53pm    
m asking for an example from your side to solve my prblm...if possible help..thanks
[no name] 15-Sep-12 13:55pm    
And what exactly have you tried that is not working? You have not defined any kind of a problem to solve so how can anyone solve it?
Raj.Rautela 15-Sep-12 14:00pm    
i want to save data entered by user on the form to database.mandatory fields are compulsory to fill but what about non mandatory fields.its upto user to fill or not..what type of query i should write.if user fills mandatory fields and or not filling mandatory fields...if the user fill that field then that value will be stored in the database but if user is not filling that field that what value will be stored in database...i got another ans to use not null and null constraints..

1 solution

At a SQL level you can only enforce null/not null constraints.

See here : http://www.w3schools.com/sql/sql_notnull.asp[^]
 
Share this answer
 
Comments
Raj.Rautela 15-Sep-12 13:54pm    
thanks sir i'll try your suggestion..

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