What risks, if any, are there in changing smallint to varchar or text? A user wants to begin using alpha characters...
in an ID field which is currently smallint.
There shouldn't be a problem. Because it's an ID field, you're not going to be doing any arithmetic on its values. The only things to watch out for are:
Change all related tables at the same time. As an ID field, it's probably a primary key, so all the foreign keys that reference it should change too.
Change how new values are generated. This may sound obvious, but if it's an IDENTITY or AUTONUMBER field, it'll stop working, and you have to change the queries that insert new rows to the table.
Performance might be slower on extremely large tables, because indexes are generally faster on integers than on strings -- but since it's a smallint, your table cannot be larger than a few thousand rows, which is a long, long way from being extremely large. You probably won't notice the difference in performance.
For More Information
- What do you think about this answer? E-mail the edtiors at editor@searchDatabase.com with your feedback.
- The Best SQL Web Links: tips, tutorials, scripts, and more.
- Have an SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
Dig Deeper on Oracle and SQL
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.