Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Update Field only by null

Author  Topic 

zero1de
Posting Yak Master

105 Posts

Posted - 2012-06-15 : 05:34:27
Hi,

How can I update the Field Dokdatum here, if it is null? If Dokdatum is not null the Field sould not be updatet.

UPDATE I
SET Nachname = P.NAME1,
Vorname = P.NAME2,
ENGAGEMENTNR = P.ENGAGEMENT,
FORDERGNR = P.FORDERGNR,
PARTNERID = P.PARTNERID,
GLAEUBIGERNR = P.GLAEUBIGERNR,
GEBURTSDATUM = P.GEBURTSDATUM,
SPARTE = P.BEZSPARTE,
ZUSTSACHB = P.AKTENEIGNER,
HAUPTSCHULDNER = P.HAUPTSCHULDNER,
Fordnr = P.Fordnr,
Dokdatum = getdate(),
ARCHIVIERT = 1
FROM immo I
INNER JOIN TBL_IMMO_PARTNER P
ON i.Fordnr = P.Fordnr or i.partnerid = p.partnerid
WHERE ISNULL(i.archiviert,0)=0
AND i.stapelnummer = 'Tiff_Printer' or i.stapelnummer='Fax/E-Mail'

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-06-15 : 05:37:13
Dokdatum = coalesce(Dokdatum, getdate())

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

zero1de
Posting Yak Master

105 Posts

Posted - 2012-06-15 : 07:00:09
THX

quote:
Originally posted by nigelrivett

Dokdatum = coalesce(Dokdatum, getdate())

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.

Go to Top of Page
   

- Advertisement -