Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Append prefix to OrderID upon insert of new record

Posted on 2007-10-03
Medium Priority
Last Modified: 2012-06-27
Upon the insert of a new record, I need to append a two character prefix to the OrderID which is an identity value.

How would I accomplish with in SQL Server 2005 ?
Question by:jnsimex
LVL 25

Accepted Solution

Lee Savidge earned 500 total points
ID: 20007061

As far as I know you can't do this. The identity field is managed by SQL and can't be altered. It will error if you alter it. The only way around this is to have a second field that contains the same value as the identity value which you can then alter. You would do this with a SQL trigger.


LVL 27

Expert Comment

ID: 20007127
Yes, Isavidge is right.

The ID property must be a numeric value. You cannot modify the column to accept characters and maintain the IDENTITY property. The identity options are grayed out.


Author Comment

ID: 20014163
thanks guys!

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question