Jump to content

updating datatypes?


natnat

Recommended Posts

I am trying to find the syntax used to chnge a datatype. The reason why is because i had a datatype that is only to allow up to 5 numbers to be entered. the datatype i used is varchar(5). when I test it, if more than 5 numbers are entered, it takes them anyway and just truncates the numbers entered after the 1st five.I'm thinking that if I change my datatype to int(5) instead, that will correct the problem. Am i right? and if so.. does anyone know the correct syntax to change it, or where i can find it?

Link to comment
Share on other sites

actually it is INT(4) by default. That doesn't limit it to 4 characters (actually I do not know the limit of INT but the best way is to limit the user input on the application interface.

Link to comment
Share on other sites

how would I do that?I am doing everything from the command prompt so I dont have an interface I'm looking at or using.do you mean that I need to write some sort of code that says..if char entered over 5 numbers, write error message..?something like that?

Link to comment
Share on other sites

oh, I have no idea how to do that in command line.I think VARCHAR is your best bet even though it truncates. Are you just testing or is the this going to be a program that makes users use command line?

Link to comment
Share on other sites

just testing..so I'm pretty sure if I do use this for production, the final product will have a GUI and its probably going to be webbased for our company's intranet which I to be honest dont know how to do exactly

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...