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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-12-22 : 08:25:14
|
| Chuah writes "Hi, is it possible to have primary key such as SVC2003-1, where 2003 is the year while the no 1 is the auto increment no?The 2003 should change according to the year(e.g in year 2004 the primary key should be SVC2004-1). How should i write the SQL statement? I'm using SQL Server 2000 and asp.net. Hope you can help me with this because it's for my project. Thanking you in advance." |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2003-12-22 : 08:43:17
|
| Nope, you can't. Store the individual parts of your key in separate columns and combine them whenever you retrieve data. Don't store it in a concatenated form, it's a lot easier to join them at run time, than having to split them if you ever need to. You will also avoid the issues of incrementing the number part of it.OwaisWe make a living out of what we get, but we make a life out of what we give. |
 |
|
|
|
|
|