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 |
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2009-01-09 : 12:46:21
|
| I have the following variable in SP: @FilePathIt has the full filepath including filename & its extension.How can i check the file extension if it is ".doc" or ".rtf" then replace just the file extension to ".pdf"Thank you very much for the help. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-09 : 13:03:47
|
| REPLACE(REPLACE(@FilePath,'.doc','.pdf'),'.rtf','.pdf') |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-01-09 : 13:11:30
|
| select Case when substring(@Filepath,charindex('.',@filepath),4) in( '.doc','.rtf') then Replace(@filepath,right(@Filepath,4),'.pdf')else @Filepath end |
 |
|
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2009-01-09 : 13:29:45
|
Thank you Visakh, your answers are always smart........ quote: Originally posted by visakh16 REPLACE(REPLACE(@FilePath,'.doc','.pdf'),'.rtf','.pdf')
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-09 : 13:34:06
|
| welcome |
 |
|
|
|
|
|
|
|