Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with updating single char in char field

Status
Not open for further replies.

alqsp

Programmer
Dec 12, 2001
9
AU
Hi, I need help in updating the 39 character of a 40 char field:

update Tabaddr
set Addr(39th char only) = 0
where Addr_num = 4

Does anyone know how to make an update to just the one character in the Addr field? Something like Addr(39:1?
 
Check to see if your DB engine has the mid function....
update Tabaddr
set mid(addr,39,1)= 0
where Addr_num = 4
 
In SQL Server -
Code:
UPDATE Tabaddr
SET Addr = STUFF(Addr, 39, 1, '0')
where Addr_num = 4
In Access -
Code:
UPDATE tabaddr
SET Addr = Left(Addr, 38) & '0' & Right(Addr, 1)
where Addr_num = 4

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top