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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Replacing the output of a query

Author  Topic 

Johnph
Posting Yak Master

103 Posts

Posted - 2012-09-19 : 16:29:38
Hello,

I have a query that always bring back one result:

Select [COLUMN] FROM [TABLE]


The results look like this:
Test.txt

I want to write the query so that it can replace the .txt with .xlsx without changing the data in the table.

For example:
Test.xlsx

Do I have to use REPLACE here? I am unfimilar with this.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-09-19 : 16:34:05
Select REPLACE([COLUMN],'.txt','.xlsx') FROM [TABLE]
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2012-09-19 : 16:34:47
select replace([column], '.txt', '.xlsx') from [table]

Be One with the Optimizer
TG

EDIT:
Go to Top of Page

Johnph
Posting Yak Master

103 Posts

Posted - 2012-09-19 : 17:14:58
Hey guys, thanks so much!
Go to Top of Page
   

- Advertisement -