Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
JDrown
Starting Member
10 Posts |
Posted - 2007-10-17 : 10:54:00
|
| I need to format a numeric column (all have 7 digits) to rendered in an SQK statements as "00-00-0000". Assume the name of the table and column name are Part and Part Description. How would I write it correctly in Transact-SQL? I've come from Access, and the differences between the two stagger me. Please help if possible. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-10-17 : 10:58:03
|
SELECT STUFF(STUFF(Col1, 5, 0, '-'), 3, 0, '-')FROM Table1SELECT LEFT(Col1, 2) + '-' + SUBSTRING(Col1, 3, 2) + '-' + RIGHT(Col1, 4)FROM Table1 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2007-10-17 : 16:24:34
|
quote: Originally posted by X002548 You shouldn't drink before NoonBrett8-)
Wrong! ;) |
 |
|
|
|
|
|