Cov txheej txheem:

Koj yuav hloov kho qhov kev txwv uas twb muaj lawm hauv SQL li cas?
Koj yuav hloov kho qhov kev txwv uas twb muaj lawm hauv SQL li cas?

Video: Koj yuav hloov kho qhov kev txwv uas twb muaj lawm hauv SQL li cas?

Video: Koj yuav hloov kho qhov kev txwv uas twb muaj lawm hauv SQL li cas?
Video: Автоматизация с Adobe Acrobat Pro! Пакетное преобразование файлов PDF 2024, Hlis ntuj nqeg
Anonim

Lub syntax rau tsim ib check txwv hauv ib ALTER TABLE nqe lus hauv SQL ntawv Server (Kev hloov pauv- SQL ntawv ) yog: ALTER TABLE table_name ADD CONSTRAINT constraint_name KOOB (column_name condition); table_npe. Lub npe ntawm lub rooj uas koj xav tau hloov kho los ntawm kev ntxiv ib check txwv.

Ib yam li ib tug yuav nug, koj yuav hloov kho qhov 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.

Qhov thib ob, kuv yuav ntxiv cov kev txwv hauv SQL li cas? Siv SQL Server Management Studio

  1. Hauv Object Explorer, nthuav cov lus uas koj xav ntxiv ib qho kev txwv kos, txoj cai-nias qhov txwv thiab nyem New Constraint.
  2. Nyob rau hauv lub Check Constraints dialog box, nyem rau ntawm Expression teb thiab ces nias lub ellipses ().

Raws li txoj cai, peb tuaj yeem hloov qhov txwv hauv SQL?

Tsis muaj. Peb ua tsis tau hloov tus txwv , tsuas yog yam peb ua tau yog poob thiab recreate nws. Ntawm no yog CREATE thiab DROP tsab ntawv. Yog koj sim ua hloov tus txwv nws yuav pov yuam kev.

Qhov kev txwv txiav txim ua dab tsi?

Cov CHECK txwv yog siv los txwv tus nqi ntau yam uas ua tau muab tso rau hauv ib kem. Yog koj txhais a CHECK txwv ntawm ib kem nws tso cai rau tej yam tseem ceeb rau kem no xwb. Yog koj txhais a CHECK txwv ntawm ib lub rooj nws ua tau txwv cov nqi hauv qee kab raws li qhov muaj nuj nqis hauv lwm kab hauv kab.

Pom zoo: