Avatar of rthriller
rthriller
Flag for France asked on

I need a sql script or c# code to update a column in a table

Hello

I am using a program that stores pathes to some data on a column called pathes in a table called storage.

This program was storing it's data in c: and all the rows contain something like "c:\program files\thesoftware\storage\data\body####.bin" where #### is a number.

Now my c: is getting full, so I moved the data to "e:\thesoftware\storage\data\body####.bin"

how can I change all the rows in the table to let it point to the files in "e:" instead of "c:\program files"

i.e.   "c:\program files\thesoftware\storage\data\body1548.bin" ==> "e:\thesoftware\storage\data\body1548.bin"

I need an sql script or some c# code.

Thank you
.NET ProgrammingMicrosoft SQL Server 2005

Avatar of undefined
Last Comment
rthriller

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Aneesh

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
rthriller

ASKER
this didn't work!

Msg 8116, Niveau 16, État 1, Ligne 1
Argument data type ntext is invalid for argument 1 of replace function.
rthriller

ASKER
Ok, I noticed that the column content is always less than 255 chars so I converted it to varchar(MAX), ran the query above and reconvert it back to ntext and it worked! :)

Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes