SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Update Field only by null
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

zero1de
Yak Posting Veteran

Germany
66 Posts

Posted - 06/15/2012 :  05:34:27  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

United Kingdom
3328 Posts

Posted - 06/15/2012 :  05:37:13  Show Profile  Visit nigelrivett's Homepage  Reply with Quote
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
Yak Posting Veteran

Germany
66 Posts

Posted - 06/15/2012 :  07:00:09  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000