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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting Data at the end of a field

Status
Not open for further replies.

cpark87

Programmer
May 14, 2004
23
US
I need to insert data into a text field but do not want to overwrite the existing data in this field. I only want to add the new data at the end of the line. The code I currently have to do the insert is listed here

Insert into dbo.Deployment
Set dbo.Deployment.Comments = dbo.NewData.Comments
From dbo.NewData
Where dbo.NewData.MachineID = dbo.NewData.MachineID

Any help would be appreciated
 
Use an update statement instead. Assuming you actually have NewData and Deployment table, and that NewData and Deployment are linked through a common MachineID, the following query should work:

Code:
update dbo.Deployment
Set dbo.Deployment.Comments = dbo.Deployment.Comments + 
    ' ' + dbo.NewData.Comments
from dbo.Deployment, dbo.NewData    
where dbo.Deployment.MachineID = dbo.NewData.MachineID


TR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top