What is uniqueidentifier as a data type?
Also what is the data type for setting unique STRINGS ((nchar,
nvarchar), for example to be used for emails and user names in a user
registration system).
SQL Server does not allow me set primary keys for columns where data
types are not INT.
Thanks in advance.A uniqueidentifier is equivelent to a GUID, if you've ever used it in
any other programming language. As for SQL Server not allowing you to
use other data types than int, you must be misinterpreting the errror
message. What error message do you see?
Dot Net Daddy wrote:
Quote:
Originally Posted by
Hello,
>
What is uniqueidentifier as a data type?
>
Also what is the data type for setting unique STRINGS ((nchar,
nvarchar), for example to be used for emails and user names in a user
registration system).
>
SQL Server does not allow me set primary keys for columns where data
types are not INT.
>
Thanks in advance.
Quote:
Originally Posted by
What is uniqueidentifier as a data type?
A uniqueidentifier is a 128-bit value, which is generated in such a way
that it is guaranteed to be unique in the whole universe. (Well, at least
this planet.) They are not specific to SQL Server, but Windows has them
all over the place, but calls them GUIDs.
Quote:
Originally Posted by
Also what is the data type for setting unique STRINGS ((nchar,
nvarchar), for example to be used for emails and user names in a user
registration system).
>
SQL Server does not allow me set primary keys for columns where data
types are not INT.
Huh? You can use almost any data type for primary keys. Since a primary
key is an index, the total key size may not execeed 900 bytes, so you
cannot use things like text or nvarchar(MAX).
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Great. It has done it. I was using nvarchar(MAX) as you told.
Now it is ok.
Thank you very much for your help guys.
Erland Sommarskog wrote:
Quote:
Originally Posted by
Dot Net Daddy (cagriandac@.gmail.com) writes:
Quote:
Originally Posted by
What is uniqueidentifier as a data type?
>
A uniqueidentifier is a 128-bit value, which is generated in such a way
that it is guaranteed to be unique in the whole universe. (Well, at least
this planet.) They are not specific to SQL Server, but Windows has them
all over the place, but calls them GUIDs.
>
Quote:
Originally Posted by
Also what is the data type for setting unique STRINGS ((nchar,
nvarchar), for example to be used for emails and user names in a user
registration system).
SQL Server does not allow me set primary keys for columns where data
types are not INT.
>
Huh? You can use almost any data type for primary keys. Since a primary
key is an index, the total key size may not execeed 900 bytes, so you
cannot use things like text or nvarchar(MAX).
>
>
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
>
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx
No comments:
Post a Comment