Cov txheej txheem:

Yuav ua li cas kuv tso ib qho kev txwv hauv SQL?
Yuav ua li cas kuv tso ib qho kev txwv hauv SQL?

Video: Yuav ua li cas kuv tso ib qho kev txwv hauv SQL?

Video: Yuav ua li cas kuv tso ib qho kev txwv hauv SQL?
Video: Yuav ua li cas thiaj khiav dim lub ntiajteb no 2024, Kaum ib hlis
Anonim

Lub SQL syntax tshem tawm qhov txwv los ntawm lub rooj yog,

  1. ALTER TABLE "table_name" DROP [ CONSTRAINT |INDEX] "CONSTRAINT_NAME";
  2. ALTER TABLE Customer DROP INDEX Con_First;
  3. ALTER TABLE Customer DROP CONSTRAINT Con_First;
  4. ALTER TABLE Customer DROP CONSTRAINT Con_First;

Raws li, yuav ua li cas ntxiv thiab tshem tawm cov kev txwv hauv SQL?

Rau ntxiv ib tug tshwj xeeb los yog lub ntsiab tseem ceeb, ib tug referential txwv , los yog check txwv , siv cov Tsim TABLE los yog ALTER TABLE nqe lus. Rau tshem tawm a txwv , siv ALTER TABLE nqe lus. Txhawm rau ua kom tus yuam sij no yog tus yuam sij tshwj xeeb, hloov lo lus tseem ceeb PRIMARY nrog UNIQUE.

Ib tug kuj yuav nug, koj yuav hloov cov kev txwv hauv SQL li cas? Siv SQL Server Management Studio

  1. Hauv Object Explorer, right-click lub rooj uas muaj cov kev txwv kos thiab xaiv Tsim.
  2. Nyob rau ntawm Table Designer ntawv qhia zaub mov, nyem Kos Cov Kev Txwv.
  3. Nyob rau hauv Cheeb Tsam Constraints dialog box, nyob rau hauv Selected Check Constraint, xaiv qhov txwv koj xav hloov.

Tom qab ntawd, lo lus nug yog, koj tuaj yeem tshem tawm qhov kev txwv?

Tshem tawm qhov txwv . Koj tuaj yeem yooj yim tshem tawm ib qho kev txwv los ntawm ob npaug rau nyem rau ntawm txoj haujlwm> cov ntaub ntawv ua haujlwm> qib siab> txwv ntaus > sai li sai tau.

Peb puas tuaj yeem tso tseg qhov kev txwv tseem ceeb?

Muab Cov Ntsiab Tseem Ceeb Tso Rau Koj ua tsis tau poob a thawj qhov tseem ceeb txwv yog lwm lub rooj muaj txawv teb chaws qhov tseem ceeb txwv uas references thawj tus yuam sij . Rau poob tus thawj tus yuam sij , koj yuav tsum xub poob tag nrho txawv teb chaws cov yuam sij uas siv nws.

Pom zoo: