October 28, 2014 at 11:16 am
Hi,
I have table with column values as below. I need to change the folder name from QA to PROD. Please advise.
C:\QA\Documents\pdf1
C:\QA\Documents\pdf2
C:\QA\Documents\pdf3
C:\QA\Documents\pdf4
C:\QA\Documents\pdf5
.
.
.
and I need to change the path as below:
C:\PROD\Documents\pdf1
C:\PROD\Documents\pdf2
C:\PROD\Documents\pdf3
C:\PROD\Documents\pdf4
C:\PROD\Documents\pdf5
.
.
.
October 28, 2014 at 11:24 am
Something like this, I imagine:
UPDATEYourTable
SET[YourPathname] = REPLACE([YourPathname] , '\QA\' , '\PROD\' )
- Adam
October 28, 2014 at 11:24 am
Here are two options:
CREATE TABLE Fun_Test( Somepath nvarchar( 50 ));
INSERT INTO Fun_Test
VALUES
( 'C:\QA\Documents\pdf1' ),
( 'C:\QA\Documents\pdf2' ),
( 'C:\QA\Documents\pdf3' ),
( 'C:\QA\Documents\pdf4' ),
( 'C:\QA\Documents\pdf5' );
SELECT Somepath,
REPLACE( Somepath, 'C:\QA\', 'C:\PROD\' ),
STUFF( Somepath, 4, 2, 'PROD' )
FROM Fun_Test;
GO
DROP TABLE Fun_Test;
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply