Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Updating a field to amend a the text within


Message #1 by dfalconer@g... on Wed, 12 Dec 2001 18:40:05
I have a field in one of the tables in my SQL database which contains file 

paths,

there are alot of records in the table in question

but all the entries in the field start with E:/ i want to go through the 

database and update all the fields by removing the E:/ which begins each 

entry.



e.g.

 Table A

File Field



E:/file1.asp

E:/file2.asp

E:/file8.asp



i want these to change to



file1.asp

file2.asp

file8.asp



How would i do this? There is too much data to do it by hand
Message #2 by David Cameron <dcameron@i...> on Thu, 13 Dec 2001 09:05:44 +1100
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C18359.25550E46

Content-Type: text/plain



I think this most easily done with a procedural language or a cursor.



regards

David Cameron

nOw.b2b

dcameron@i...



-----Original Message-----

From: dfalconer@g... [mailto:dfalconer@g...]

Sent: Thursday, 13 December 2001 4:40 AM

To: ASP Databases

Subject: [asp_databases] Updating a field to amend a the text within





I have a field in one of the tables in my SQL database which contains file 

paths,

there are alot of records in the table in question

but all the entries in the field start with E:/ i want to go through the 

database and update all the fields by removing the E:/ which begins each 

entry.



e.g.

 Table A

File Field



E:/file1.asp

E:/file2.asp

E:/file8.asp



i want these to change to



file1.asp

file2.asp

file8.asp



How would i do this? There is too much data to do it by hand




$subst('Email.Unsub').




Message #3 by "Dallas Martin" <dmartin@z...> on Wed, 12 Dec 2001 19:22:57 -0500

Assuming field1 = "e:/"

SQL Server 7.0

"UPDATE table1 SET field1 = right(field1,len(field1)-3) WHERE field1 like

"e:/%"



SQL 6.5

"UPDATE table1 SET field1 = right(field1,datalength(field1)-3) WHERE field1

like "e:/%"



Dallas





----- Original Message -----

From: "David Cameron" <dcameron@i...>

To: "ASP Databases" <asp_databases@p...>

Sent: Wednesday, December 12, 2001 5:05 PM

Subject: [asp_databases] RE: Updating a field to amend a the text within





> I think this most easily done with a procedural language or a cursor.

>

> regards

> David Cameron

> nOw.b2b

> dcameron@i...

>

> -----Original Message-----

> From: dfalconer@g... [mailto:dfalconer@g...]

> Sent: Thursday, 13 December 2001 4:40 AM

> To: ASP Databases

> Subject: [asp_databases] Updating a field to amend a the text within

>

>

> I have a field in one of the tables in my SQL database which contains file

> paths,

> there are alot of records in the table in question

> but all the entries in the field start with E:/ i want to go through the

> database and update all the fields by removing the E:/ which begins each

> entry.

>

> e.g.

>  Table A

> File Field

>

> E:/file1.asp

> E:/file2.asp

> E:/file8.asp

>

> i want these to change to

>

> file1.asp

> file2.asp

> file8.asp

>

> How would i do this? There is too much data to do it by hand




> $subst('Email.Unsub').

>

>




$subst('Email.Unsub').

>




  Return to Index