SELECT cast ((545458874489 (format ‘999-999-9999′)) as char (15)) as Format_Cast_PhoneNum
Output would be something like follows;
Format_Cast_PhoneNum
***********
This happens because of the number of digits presented (12 in this case) to the format function is more than the number of symbol digits (10 in this case) or format characters available in the format command.
Again,Number of digits presented is 12 è 545458874489
Number of Symbolic character is 10 è 999-999-9999 (excluding the dash character)
Hence, you get error in your output.
How to solve this? Just make sure that the number of Symbolic character/digit is always equal or greater than the number of digits presented for formatting/conversion. The above SQL can be written in as follows to get a correct result.
SELECT cast ((545458874489 (format ‘99-999-999-9999′)) as char (15)) as Format_Cast_PhoneNum
Popularity: 19% [?]
Our Random Articles
- New Year Wishes 2010
- New Year Wishes
- How to use EXTRACT function with date and time columns
- How to Post on a Separate/New Page in WordPress
- Usage of Macro in Teradata
More Links




No Comment
Popular Articles