La forma más eficiente de almacenar un valor GUID en la base de datos SQL Server
Digamos, si necesito almacenar valores GUID no repetitivos (algo así como {AB50C41E-3814-4533-8F68-A691B4DA9043}
) en la base de datos de SQL Server, ¿cuál es la forma más eficiente de definir la columna para almacenarla? (es decir, como cadena, un blob, o convertirlo en un entero de 16 bytes.)
PS. La columna debe definirse como un ÍNDICE y ser ÚNICA.
28
2 answers
- Use el tipo de datos uniqueidentifier que está diseñado para GUID
Por ejemplo, se ordenarán como deberían los GUID - Cree un índice ÚNICO en él (más flexible que una restricción única
Nota, estos son 2 pasos separados
38
Author: gbn,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-12-30 05:48:48
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-12-30 05:48:48
Puede utilizar uniqueidentifier datatype
8
Author: Pavan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-12-30 05:43:54
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-12-30 05:43:54