October 19, 2010 at 9:11 pm
I have a field called "OrderID" i want this field auto generate"Unique" let say "COV-YYMMDDSS" so every time ORderid create it should be unique. Please send me t-sql code. Thanks in advance.
October 20, 2010 at 1:55 pm
Your requirement is not clear.
What do you mean by "auto generate"? Are you looking for some kind of an identity column in a custom format?
To ensure you only have unique entries ou could add a UNIQUE constraint to your table. See BOL (BooksOnLine, the SQL Server help system usually installed together with SQL Server), section "ALTER TABLE (Transact-SQL) ".
Please send me t-sql code.
Sure. Please send me the money. 😉
We're here to help you to improve your T-SQL skills, not to do your job for you.
Give it a try first, see where you get stuck and post back what you have so far.
October 20, 2010 at 2:07 pm
Also asked here: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=151816
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
October 20, 2010 at 2:07 pm
And you may want to consider some of the points people mentioned on this other thread:
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply