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 |
|
tariq2
Posting Yak Master
125 Posts |
Posted - 2012-05-10 : 10:52:10
|
| Hi.I would like to extract the first 10 digits of each of the following, so that i get:1201531201, 1201531202 etc.etc.I can obviously use SUBSTRING('1201531201 - PFJ 2012',1,10)for each row, but is there someyhing more efficient? Thank you1201531201 - PFJ 20121201531202 - PFJ 20121201531203 - PFJ 20121201531204 - PFJ 20121201531205 - PFJ 20121201531206 - PFJ 20121201531207 - PFJ 20121201531208 - PFJ 20121201531209 - PFJ 20121201531210 - PFJ 20121201531211 - PFJ 20121201531212 - PFJ 20121201531213 - PFJ 20121201531214 - PFJ 20121201531215 - PFJ 20121201531216 - PFJ 20121201531217 - PFJ 20121201531218 - PFJ 20121201531219 - PFJ 20121201531220 - PFJ 20121201531221 - PFJ 20121201531222 - PFJ 20121201531223 - PFJ 20121201531224 - PFJ 20121201531225 - PFJ 2012 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-05-10 : 10:58:35
|
nope. It is can be a little shorter if you use LEFT(<column> , 10) that all. It is not really more efficient that what you have KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-10 : 11:59:11
|
| will it always be 10 digits you want or are you looking at always first part ie part before -?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|