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 |
|
footohi
Starting Member
10 Posts |
Posted - 2006-05-24 : 17:09:28
|
| This one is driving me nuts...try this -USE NORTHWINDSET NOCOUNT ONselect ORDERID, REPLACE(CONVERT(char,ORDERDATE,101),'/',''), '01'from ORDERSI'm doing this in an output statement on my table, why is the 2nd column so wide? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-05-24 : 17:18:53
|
| The REPLACE function is causing this. Try this instead:select ORDERID, CONVERT(char(8), REPLACE(CONVERT(varchar(10), orderdate, 101), '/', '')), '01'from ORDERSYou could also use SUBSTRING or various other character functions to fix this.Tara Kizeraka tduggan |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-05-24 : 17:20:19
|
| [code]use NORTHWINDset nocount onselect ORDERID, left(replace(convert(varchar,ORDERDATE,101),'/',''),8), '01'from ORDERS[/code]CODO ERGO SUM |
 |
|
|
|
|
|
|
|