I have some numbers which are not uniform in size. Now if I have to put '.TIF' at the end of each number, which...
command can I use? For example, 123, 4567, 78901. This I want to update as 123.TIF, 4567.TIF...
All you need to do here is CAST the number as a VARCHAR datatype and then do the concatenation --
select cast(yournumber as varchar(8)) || '.TIF' from yourtable
When the number is converted to VARCHAR, it becomes a string that is just long enough to hold the digits of the number. Use a varchar length that is big enough to hold the largest number.
For More Information
- Dozens more answers to tough SQL questions from Rudy Limeback.
- 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.