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 |
|
gavakie
Posting Yak Master
221 Posts |
Posted - 2008-12-17 : 12:13:13
|
| I have a column with picture links some have a /picture.jpg others just have picture.jpg I need all to have a slash in front of them how can I do that with a substring? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-17 : 12:17:19
|
| [code]UPDATE table SET column='/'+columnWHERE left(column,1) <> '/'[/code] |
 |
|
|
gavakie
Posting Yak Master
221 Posts |
Posted - 2008-12-17 : 12:31:13
|
| I dont have permissions to do an update to the table so I need another way thanks though |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-17 : 12:33:08
|
then do it while retrieving data in selectSELECT CASE WHEN left(column,1) = '/' THEN column ELSE '/'+column END as Col FROM Table |
 |
|
|
gavakie
Posting Yak Master
221 Posts |
Posted - 2008-12-17 : 12:41:13
|
| there isnt a way for a substring? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-17 : 12:45:37
|
| no need whats the problem with case statement? |
 |
|
|
gavakie
Posting Yak Master
221 Posts |
Posted - 2008-12-17 : 12:49:53
|
| I keep getting a bad charecter in format. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-17 : 12:55:04
|
| bad character? can you post it? whats the character you're getting? |
 |
|
|
gavakie
Posting Yak Master
221 Posts |
Posted - 2008-12-17 : 12:55:54
|
| I think its complaining about the data type and when I try to convert or cast I still get the error. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-17 : 12:57:57
|
| post the error msg |
 |
|
|
|
|
|