Sql server® 2012 t-sql fundamentals



Download 10,93 Mb.
Pdf ko'rish
bet326/443
Sana26.01.2022
Hajmi10,93 Mb.
#411755
1   ...   322   323   324   325   326   327   328   329   ...   443
Bog'liq
BookSQL

 

CHAPTER 8

 

Data Modification



 

 285

This MERGE statement uses the OUTPUT clause to return the old and new values of the modified 

rows. Of course, with INSERT actions, there are no old values, so all references to deleted attributes 

return NULL marks. The $action function tells you whether an UPDATE or an INSERT action produced 

the output row. Here’s the output of this MERGE statement.

theaction custid oldcompanyname newcompanyname 

--------- ------ -------------- -------------- 

UPDATE    2      cust 2         AAAAA          

UPDATE    3      cust 3         cust 3         

UPDATE    5      cust 5         BBBBB          

INSERT    6      NULL           cust 6 (new)   

INSERT    7      NULL           cust 7 (new)   

 

theaction custid oldphone       newphone       oldaddress newaddress 



--------- ------ -------------- -------------- ---------- ---------- 

UPDATE    2      (222) 222-2222 (222) 222-2222 address 2  address 2 

UPDATE    3      (333) 333-3333 (333) 333-3333 address 3  address 3 

UPDATE    5      (555) 555-5555 CCCCC          address 5  DDDDD 

INSERT    6      NULL           (666) 666-6666 NULL       address 6 

INSERT    7      NULL           (777) 777-7777 NULL       address 7 

 

(5 row(s) affected)




Download 10,93 Mb.

Do'stlaringiz bilan baham:
1   ...   322   323   324   325   326   327   328   329   ...   443




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish