Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 I have two queries

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-01-31 : 08:17:55
Salim Aboobaker writes "I've created a customer table and I want to give each customer a unique id e.g 'ES001' But sql server won't let me I've looked at various books to no avail.

My second question is when I delete a row from a table which had an ID of 2 when I put in a new row it gives the new row and ID of 3 how do i make it give the row an ID of 2."

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-01-31 : 08:31:00
If you want to give each customer an id
Update table set CustId='ES001'

Remove Identity property of that column and Insert it by finding maximumn id

Madhivanan



Go to Top of Page

SqlStar
Posting Yak Master

121 Posts

Posted - 2005-02-01 : 06:14:46
Hi madhivanan,

I hope he aware about that update statement, which you written but his expectation something different.

The solution for updating identity value use this command "DBCC CHECKIDENT".See more details in SQL Server help document.

:) While we stop to think, we often miss our opportunity :)
Go to Top of Page
   

- Advertisement -