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 |
|
sqltenderfoot
Starting Member
5 Posts |
Posted - 2010-11-02 : 08:13:19
|
| Hi Guru's,I am running a query on SQL 2005, and am copying the result manually to Excel. Unfortunately, a number as 01234 changes in 1234 in Excel. So I want to concatenate ' and 01234 in the output, so Excel understands it is a text.The problem is that when I try i.e. select ''01234', SQL doesnt like this.Any suggestions?best regards and thanks in advance. |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2010-11-02 : 08:23:10
|
| format the column as text before you do the copy.Be One with the OptimizerTG |
 |
|
|
sqltenderfoot
Starting Member
5 Posts |
Posted - 2010-11-02 : 08:32:49
|
| Hi TG, Thanks for reply, this is indeed how I am doing it now.However I like to automate this. AK |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-11-02 : 08:49:49
|
| Try thisselect ''''+cast(01234 as varchar(10))MadhivananFailing to plan is Planning to fail |
 |
|
|
sqltenderfoot
Starting Member
5 Posts |
Posted - 2010-11-02 : 08:59:36
|
| Thanks Madhivanan,This is what I was looking for.AK |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-11-02 : 11:38:12
|
quote: Originally posted by sqltenderfoot Thanks Madhivanan,This is what I was looking for.AK
You are welcome MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|