Cov txheej txheem:

Yuav ua li cas koj tso ib qho kev txwv hauv db2?
Yuav ua li cas koj tso ib qho kev txwv hauv db2?

Video: Yuav ua li cas koj tso ib qho kev txwv hauv db2?

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

Txheej txheem

  1. Kom meej meej poob tshwj xeeb kev txwv , siv cov DROP UNIQUE clause ntawm ALTER TABLE nqe lus.
  2. Rau txo cov kev txwv tseem ceeb , siv cov DROP PRIMARY KEY clause ntawm ALTER TABLE nqe lus.
  3. Rau poob (rooj) check kev txwv , siv cov DROP CHECK clause ntawm ALTER TABLE nqe lus.

Ib yam li ntawd, kuv yuav ua li cas tso ib daim tshev txwv?

Lub syntax rau poob a xyuas qhov txwv hauv SQL Server (Transact-SQL) yog: ALTER TABLE table_name DROP CONSTRAINT constraint_name; table_npe. Lub npe ntawm lub rooj uas koj xav tau poob tus xyuas qhov txwv.

Ib tug kuj yuav nug, nqe lus twg yuav tso cai rau koj los cuam tshuam qhov kev txwv? ALTER TABLE hais kom ua nrog MODIFY clause tau siv los ua disable ib qho kev txwv.

Tib neeg kuj nug, peb puas tuaj yeem tshem tawm cov kev txwv hauv qhov tseem ceeb lossis txawv teb chaws?

Hauv qhov no koj tuaj yeem rho tawm thawj tus yuam sij ncaj qha. Yog tias txawv teb chaws key tsis yog thawj tus yuam sij nyob rau hauv lwm lub rooj rooj ces koj yuav tsum siv rau rho tawm cascade lus rau rho tawm tus thawj tus yuam sij . Cov lus ntawd yuav rho tawm tus yuam sij txawv teb chaws los ntawm ob lub rooj thiab ces rho tawm thawj tus yuam sij.

Dab tsi yog poob clause ntawm alter table?

DROP CONSTRAINT Clause . Siv cov DROP CONSTRAINT lus txhawm rau rhuav tshem qhov kev txwv uas twb muaj lawm uas nws lub npe koj teev. Qhov no syntax fragment yog ib feem ntawm ALTER TABLE nqe lus.

Pom zoo: