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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
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"
1="sucess"
0="failure"
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