Unique field
-
using a Sql Server DB , and having a field 'ID' with a 'varchar' datatype, how can i set the criteria of this field to be : unique No dupplicatate (like MS-Access) to dissallow the user to enter the same value twice thx
Regards Ramy
-
using a Sql Server DB , and having a field 'ID' with a 'varchar' datatype, how can i set the criteria of this field to be : unique No dupplicatate (like MS-Access) to dissallow the user to enter the same value twice thx
Regards Ramy
you can set the primary key for that field so that you can prevent the dupliacates
Sathesh Pandian
-
you can set the primary key for that field so that you can prevent the dupliacates
Sathesh Pandian
sathesh_pandian wrote:
you can set the primary key for that field so that you can prevent the dupliacates
Which is not a valid thing to do if you already have a primary key! Do NOT set a column as a primary key just to make it unique. There you can apply a unique constraint to columns.
Upcoming events: * Glasgow: Geek Dinner (5th March) * Edinburgh: Web Security Conference Day for Windows Developers (12th April) My: Website | Blog | Photos
-
using a Sql Server DB , and having a field 'ID' with a 'varchar' datatype, how can i set the criteria of this field to be : unique No dupplicatate (like MS-Access) to dissallow the user to enter the same value twice thx
Regards Ramy
When you create your table you can do something like this:
CREATE TABLE dbo.MyTable
(
MyUniqueColumn varchar(30) NULL UNIQUE NONCLUSTERED
)
Upcoming events: * Glasgow: Geek Dinner (5th March) * Edinburgh: Web Security Conference Day for Windows Developers (12th April) My: Website | Blog | Photos