Cov txheej txheem:

Yuav ua li cas kuv undo SQL hloov tshiab?
Yuav ua li cas kuv undo SQL hloov tshiab?

Video: Yuav ua li cas kuv undo SQL hloov tshiab?

Video: Yuav ua li cas kuv undo SQL hloov tshiab?
Video: Data Science with Python! Analyzing File Types from Avro to Stata 2024, Kaum ib hlis
Anonim

Koj tuaj yeem thim rov qab cov kev hloov pauv uas tseem tsis tau cog lus rau kev tswj hwm qhov chaw

  1. Hauv Object Explorer, right-click cov khoom, nplaub tshev, lossis database nrog kev hloov pauv koj xav tau thim rov qab , xaiv Lwm yam SQL ntawv Qhov chaw tswj cov haujlwm > Tshem tawm kev hloov.
  2. Xaiv cov khoom nrog kev hloov pauv koj xav tau thim rov qab thiab nias Tshem tawm Hloov.

Raws li txoj cai, koj tuaj yeem thim rov qab cov lus nug SQL?

Tshem tawm yog hu ua rollback hauv SQL ntawv . Ib zaug koj tau ua ib qho kev cog lus, koj ua tau 't thim rov qab nws tsis tau txais mus rau hauv restore backups. Nco ntsoov tias ua rollback yuav undo ib qho kev hloov pauv tag nrho, uas txhais tau tias txhua qhov hloov tshiab, ntxig, thiab tshem tawm txij li qhov kev hloov pauv tau pib, uas feem ntau yog txij li qhov kev cog lus dhau los lossis rov qab.

Tsis tas li ntawd, kuv tuaj yeem rov qab tau cov ntaub ntawv SQL Server los ntawm kev hloov tshiab tsis muaj thaub qab li cas? Cov kev daws teeb meem feem ntau yog:

  1. Restore lub database backup thiab siv nws es tsis txhob ntawm tus thawj database.
  2. Nyob rau hauv rooj plaub uas muaj lwm yam kev hloov pauv tau tshwm sim tom qab UPDATE lossis koj tsis tuaj yeem tso cai rau cov ntaub ntawv tawm hauv offline: Rov qab cov ntaub ntawv thaub qab ntawm lub server sim. Siv SQL Server Management Studio Export cov ntaub ntawv wizard kom xa cov ntaub ntawv.

Ua li no, dab tsi yog rollback hais kom ua hauv SQL?

A ROLLBACK yog database lus txib siv rau hauv kev tswj kev lag luam rau rov qab los yav dhau los kev hloov pauv ntawm kev hloov pauv. Qhov no tuaj yeem siv rau rov qab los cov kev hloov pauv ntawm kev hloov pauv uas tsuas yog ua tom qab COMMIT kawg lossis ROLLBACK hais kom ua . Lub syntax rau rov qab yog ROLLBACK ; Piv txwv: SQL ntawv > DELETE NTAWM STUDENTS.

Kuv yuav rov qab ua li cas cov lus nug hauv MySQL?

Koj yuav xav tau teeb tsa AUTOCOMMIT = 0, thiab tom qab koj tuaj yeem muab COMMIT lossis ROLLBACK thaum kawg ntawm nug los yog kev sib kho kom xa lossis tshem tawm kev lag luam. Koj tsuas tuaj yeem ua tau li ntawd thaum lub sijhawm ua lag luam. Yeej: Yog tias koj tab tom ua ib qho kev sib pauv tsuas yog ua qhov rov qab. Txwv tsis pub, koj ua tsis tau " thim rov qab "a MySQL lus nug.

Pom zoo: