Help with Update stmt

Results 1 to 2 of 2

Thread: Help with Update stmt

  1. #1
    Join Date
    Dec 1969

    Default Help with Update stmt

    Hi,<BR><BR>I need help with an update statement.<BR><BR>I need to update only the "Not Null" values from the Info table present in fa300 db to the Info table in the current db table.<BR>In other words, if in the below example, the fa300.dbo.Info.LName field is null, then ignore that field and update all the other fields.<BR><BR>Thanks for the help in advance!<BR><BR>UPDATE Info<BR>set Info.ID = fa300.dbo.Info.ID,<BR>Info.FName= fa300.dbo.Info.FName,<BR>Info.LName = fa300.dbo.Info.LName,<BR>Info.Address = fa300.dbo.Info.Address<BR>from fa300.dbo.Info<BR>where Info.ssn = fa300.dbo.Info.ssn;<BR>

  2. #2
    Join Date
    Dec 1969

    Default Can't do it that way...

    What DB is this? That syntax for a JOINed update looks wrong for SQL Server, yet you seem to be using SQL Server.<BR><BR>I&#039;m thinking you might be able to do:<BR><BR>UPDATE Info<BR> Set ID = IsNull( ID, fa300.dbo.Info.ID ),<BR> FName = IsNull( FName, fa300.dbo.Info.FName ),<BR> .. etc ...<BR><BR>But then fix the way you are doing the JOIN for the update.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts