Link to home
Start Free TrialLog in
Avatar of ram27
ram27

asked on

how to store "sucess" and "Failure"



Hi
  i want to store  "Sucess" or "Failure" as values of specific column  called "Column1" in the table "Table1" in SQL server.
Can you please let me know which data type i should use for "Column1".


Thanks,
Ram




Thanks,
Ram.

Avatar of Deepak Lakkad
Deepak Lakkad
Flag of India image

simply you can use varchar or char data type for that.

But, also you can use smallint or tinyint and store value 1 or 0 in the field. later you have to treat this 1 and 0 in your query as "Success" and "Failure"

- Deepak Lakkad
ASKER CERTIFIED SOLUTION
Avatar of Anuj
Anuj
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
HI,
If you are sure that you always save  "Success" or "Failure" and there is no chance of any other value then BIT data type would be good. You can use it as follows
 "Sucess" =1
 "Failure"=0
  If there is chance other value may added in future than you use int field corresponding to varchar char field where int fields contains id and varchar field contains actual text like  "Sucess" or "Failure".
  And finally if you want to save exact text like  "Sucess" or "Failure" then use varchar as datatype.



Dani
Avatar of kiran_mai
kiran_mai

If you want to store only Sucess and failure words in database you can use char. if you can change the values by using code then go for bit and display in userinterface  as
1="sucess"
0="failure"