SQL Server - No Duplicate Values For Field..but not the primary key

I have a table that has a RecordID field and TicketNumber field.  The RecordID field is the primary key and auto increments.  It will not duplicate as expected.

However, I need to set my TicketNumber to "not allow duplicate values".  Is there a way to do this in SQL 2000.  Access allows you to do this without having to make it a primary key.  Does SQL Server allow this?

Thanks for any help.

9/25/2008 4:09:05 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 29

You can use a UNIQUE Constraint for this column. Run the following query:


ADD CONSTRAINT TicketNumber_UNIQ_1 UNIQUE (TicketNumber)


9/25/2008 4:36:23 PM

That did the trick, Thanks.  Where is this information kept?  Is it a property of the table?

9/25/2008 8:29:41 PM

Hi defyant_2004,

Constraints are business logic that your database server enforces for you. They limit the possible values that users can enter into specified columns, enforcing referential integrity. When you create constraints in the Database Designer, they conform to the ANSI standard for creating and altering tables.

Please refer to the following document for more information:


Jian Kang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
9/29/2008 8:41:54 AM

Similar Artilces:

SQL Server Reporting Services for SQL SERVER 2000 AND Visual Studio.NET 2005 .NET 2.0
Hi, Which version of SQl Server Reporting Services will work with SQL SERVER 2000 in pararrel with ASP.NET 2.0 (.NET 2.0 framework)?  Thanks, Azam HighOnCodingWanna get high! Hi, Okay I got the answer. Yes, we can use the SQL SERVER 2005 Reporting Services with SQL SERVER 2000. HighOnCodingWanna get high! ...

linking a sql field to point to the value of another sql field
is it possible to create hyperlinks in powerbuilder such that if you retrieve two fields from a database.. and want to display the first field on the screen and have it link to the value of the other field (when clicked) which is actually a URL address, you can? any help will be appreciated. thank you! ...

MS SQL Server 2005
Hi, I would like to automatically increment a field named `incrementID' anytime any field in any row within the table named 'tb_users' is updated. Currently I am doing it via the sql update statement. i.e "UPDATE tb_users SET name = @name, incrementID = incrementID + 1 .....WHERE id = @id; I'm wondering how I can do this automatically. for example, by changing the way sql server treats the field - kind of like the increment setting of 'Identity'. Before I update a row, I wish to check whether the incrementID of the object to be updated is different to the ...

is adaptive sql server 7.0 does not support numeric fields in primary key
Hello All I am giving numeric field in the primary key it is getting same for 1.0 and 1.1 and giving error for primary key voilation. thanks , -neelesh Is the column in the primary key fixed precision numeric (decimal, numeric), floating precision (double, float, real) or integer numeric (bigint, int, smallint, tinyint). You should not get this error with fixed precision numeric columns (decimal or numeric). If this is the case you may have found a bug and should report it. If it is a floating precision (double, float, real) column then the results are expected beca...

SQL Server 2005 Installation problems with SQL Server Express & SQL Server 2000
Hi Guys, I have had SQL Server Express and Sql Server Management Studio Express installed on my machine for some time and recently tried to install a trial of SQL Server 2005 as well.  (Yes, I'm migrating from Visual Studio Express to Visual Studio Professional, just as in tended!) Everything went fine except that nothing seemed to be installed.  I searched in all the obvious places - both on the Start/Programs menu and on the hard-drive: nothing. A check under Add/Remove Programs showed that Sql Server 2005 Express was installed, but called SQL Server 2005. So after a number o...

This version of Microsoft Sql Server Management Studio can only be used to connect to Sql Server 2000 and Sql Server 2005 servers
When I connect SQL Server 2005 to a remote database i get the error: "This version of Microsoft Sql Server Management Studio can only be used to connect to Sql Server 2000 and Sql Server 2005 servers". Can I confirm it is because: the remote db is of SQL Server 2008? There is a soln mentioned in http://forums.asp.net/t/1324047.aspx Did anybody try this (installing 2008 express: http://www.microsoft.com/express/sql/download/)? I am just checking again, whether it will disturb my existing SQL Server installation, in any means...? Though it is mentioned that it will g...

Difference between candidate key and primary key in sql server 2000.
hi can any explan  in detailed,the difference between the candidate key and primary key in sql server 2000 A table may have more than one combination of set of columns that could uniquely identify the rows in a table. Each combination is a Candidate key. We pick one of the Candidate keys to be the Primary key.Primary Key dont have NULL values, where as Candidate key column may contain one NULL value record.and By default Primary key is Clustered index.Somnath Mali.NET Developer , Pune INDIA.Please Mark As Answer If my reply helped you. Hi, read this thread : http://www...

SQL Server 2000 and SQL Server 2005 in the same server
Can enyone please send me a link to a white paper explaining how to run both SQL Server 2000 and 2005 in the same machine?Thanks. I don't know about the white paper but I had both running on my machine for a while by making the SQL 2000 a named instance. So for SQL 2005 connection strings my server name was (local) while for SQL 200 using the named instance it was (local)\joesql where joesql was the instance nameHope it helps,Joe http://www.joeaudette.comhttp://www.mojoportal.com...

SQL A and SQL Server
Hi I heard SQL Server used to be owned by Watcom is this true? Is SQL Anywhere, therefore, similar to SQL Server? -- Regards, John Not quite true. SQL Anywhere was created by Watcom. SQLServer was created by Sybase, and Microsoft licensed the technology. So MSSQL and ASE have common roots, not SQLAnywhere. -- Paul Horan[TeamSybase] "John Kingan" <john.kingan@abibuildingdata.com> wrote in message news:40d82aa1$1@forums-1-dub... > Hi I heard SQL Server used to be owned by Watcom is this true? Is SQL > Anywhere, therefore, similar to SQL Ser...

sql server and sql server express
ok i am puzzled right now....i have a web application connecting to a sql server database....i uninstalled sql server express and installed sql server 2005 full version...i changed the connection string in my application to be Data Source=SKYBANDR62;Initial Catalog=aspnetdb;Integrated Security=True and through the explorer bar i can access my database freely but when i run my application i get this error Server Error in '/' Application. -------------------------------------------------------------------------------- An error has occurred while establishing a...

SQL statement failed: (-194) No primary key value for foreign key
I'm getting this error message sporadically when my remote sites are replicating to my central server. The odd thing is the record that is the primary key value does exist! I'm at a lost...Does any have any idea, why this may be happening? Thanks Tasha Did the record exist at the time the error was reported? I have seen cases before where the Parent record is physically sent to the remote *after* the Child record. This would explain why the error was legitimately reported but when you look at the database later the Parent record now exists. -- -------------...

SQL statement failed, no primary key value for foreign key ... in table ...
Problem: SQL statement failed, no primary key value for foreign key ... in table ... After deleting or changing primary key values in either consolidated or remote database. Question: Are there any triggers that can resolve inserting a record that has a foreign key value with no existing primary key value in primary table? Description: We have a serious problem with the dbremote program. I think it's a general problem that could appear in every database with related tables. Everytime the problem turns up we must create new remote databases from the consolidated datab...

SQL Server insert query
When I am inserting into a table, I have some values which I am finding are "N/A" which obviously come from a source which allows it ie nvarchar column)  I need to check the values before entering into the column, and if it is not an integer, converting it to the value '00000000' ie a similar thing would be isnull(columnname,00000000), but in this case, not checking for if it is null, but rather if it is an integer. Does anyone have any ideas? Take a look at http://berezniker.com/content/pages/sql/microsoft-sql-server/isnumericex-udf-data-type-awareBeware of ...

Compiled sql CommandText going from DataSource to sql server
HiI need to know what command text goes to sql server in a compiled (parameterless) formatEx :I have a sql query : "Select  * from table where name=@name"name parameter has value = "bill gates"When I read the e.command.commandtext value in sqldatasource.inserting event, it gives the original command (with parameter @name)In datasource.inserting event, how can I get the compiled version of the command  : "Select * from table where name='bill gates'"please help me Why do you need to get the value?  What do you plan to do with it?Brian"Trust in the Lord and do what is good...

Web resources about - SQL Server - No Duplicate Values For Field..but not the primary key - asp.net.sql-datasource

Duplicate bridge - Wikipedia, the free encyclopedia
Duplicate bridge is the most widely used variation of contract bridge in club and tournament play. It is called duplicate because the same bridge ...

Search for duplicate files - Wikipedia, the free encyclopedia
Language: English Home Random Search for duplicate files Search for duplicate files based on hash values. 900 × 600 pixel File size: 377 B MIME ...

How to Duplicate Facebook’s Hacktober
... build and maintain a security-aware culture. Director of security operations Jennifer Henley shared tips for other companies looking to duplicate ...

Facebook adds new duplicate page finder tool for admins to report unofficial pages
Some Facebook page owners are seeing a new “Report Duplicates” module that allows them to search for pages related to their own and report those ...

faroo_p2p: FAROO Search now with robust Near Duplicate Detection. Filters scraped or syndicated content ...
faroo_p2p: FAROO Search now with robust Near Duplicate Detection. Filters scraped or syndicated content. http://t.

Cleaner – Remove Duplicate Contacts for Addressbook, iCloud, Gmail, Yahoo & Outlook for iPhone, iPod ...
Get Cleaner – Remove Duplicate Contacts for Addressbook, iCloud, Gmail, Yahoo & Outlook on the App Store. See screenshots and ratings, and read ...

How-To: Safely shrink your Mac’s giant photo library, deleting duplicate images to save space
... Apple’s new Photos app , you might be surprised to learn that you’ve lost a lot of hard drive space, and that there are suddenly tons of duplicate ...

Ubaldo Jimenez seeks to duplicate fastball command, success in second start Friday
In between so many starts in 2014, right-hander Ubaldo Jimenez spoke of the fixes he knew he needed to make to improve his performance.

Unit Testing In Java, Duplicate Code in Java GUIs
... to comment on: You're perfectly right when saying that implementing ActionListener in the window class itself usually leads to loads of duplicated ...

Resources last updated: 12/26/2015 9:38:36 AM