GUID kem hauv SQL Server yog dab tsi?
GUID kem hauv SQL Server yog dab tsi?

Video: GUID kem hauv SQL Server yog dab tsi?

Video: GUID kem hauv SQL Server yog dab tsi?
Video: Jupyter! Tracking Python Variables 2024, Kaum ib hlis
Anonim

GUID yog 16 byte binary SQL Server hom ntaub ntawv uas yog lub ntiaj teb tshwj xeeb thoob cov ntxhuav, databases, thiab servers . Lub sij hawm GUID stands rau Globally Unique Identifier thiab nws yog siv interchangeably nrog UNIQUEIDENTIFIER . Tsim ib tug GUID hauv SQL Server , NEWID() muaj nuj nqi yog siv raws li qhia hauv qab no: 1. SELECT NEWID()

Ib yam li ntawd, GUID sawv rau dab tsi?

ntiaj teb no tus cim cim

Tsis tas li ntawd, kuv yuav ua li cas thiaj li tau txais GUID tshiab hauv SQL? qhia - sql ua - server. sql ua --Yog koj xav tau tsim a tshiab Guide ( uniqueidentifier) hauv SQL server koj tsuas tuaj yeem siv NEWID() muaj nuj nqi. -- Qhov no yuav rov qab ib tshiab random uniqueidentifier e.g. Koj tuaj yeem siv qhov no ncaj qha nrog INSERT nqe lus los ntxig tshiab kab hauv rooj. --Inserting data in Employees table.

Tsis tas li ntawd, hom ntaub ntawv GUID yog dab tsi?

Cov GUID data type yog 16 byte binary hom ntaub ntawv . Qhov no hom ntaub ntawv yog siv rau kev txheeb xyuas thoob ntiaj teb ntawm cov khoom, cov haujlwm, cov ntaub ntawv, thiab lwm yam. Cov khoom tseem ceeb ntawm a GUID yog tias txhua tus nqi yog lub ntiaj teb tshwj xeeb. Tus nqi yog tsim los ntawm ib qho algorithm, tsim los ntawm Microsoft, uas lees paub qhov tsis zoo no.

Peb puas tuaj yeem siv GUID ua tus yuam sij tseem ceeb hauv lub rooj?

Raws li tau hais ua ntej, GUID tus nqi yog tshwj xeeb hla rooj , databases, thiab servers. GUIDs tau suav tias yog ntiaj teb no thawj tus yuam sij . Hauv zos siv cov yuam sij tseem ceeb txhawm rau txheeb xyuas cov ntaub ntawv hauv ib qho rooj . Ntawm qhov tod tes, GUIDs tau ua siv txhawm rau txheeb xyuas cov ntaub ntawv thoob plaws rooj , databases, thiab servers.

Pom zoo: