﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 7,2000 / T-SQL  / identity insql server / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 13:45:17 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: identity insql server</title><link>http://www.sqlservercentral.com/Forums/Topic500181-8-1.aspx</link><description>thank u sir</description><pubDate>Wed, 21 May 2008 22:22:13 GMT</pubDate><dc:creator>sunileadara1986</dc:creator></item><item><title>RE: identity insql server</title><link>http://www.sqlservercentral.com/Forums/Topic500181-8-1.aspx</link><description>I'd use an int identity column and then a computed column or a view that concatenates them.You can't do a varchar auto-incrementing field.</description><pubDate>Thu, 15 May 2008 09:02:43 GMT</pubDate><dc:creator>Steve Jones - SSC Editor</dc:creator></item><item><title>RE: identity insql server</title><link>http://www.sqlservercentral.com/Forums/Topic500181-8-1.aspx</link><description>First,  be careful of your terms. "Identity" means something specific in sql server.  In this case,  you can't use it directly,  since it must be a number or a guid.  It exists because to rapidly assign unique values to a table with little overhead.  It was not intended to be a user visible field or hold updatable information.  Avoid exposing it.  What you want is a unique key.  Some options:1)  Insert trigger.  Create a column of any type,  make it a unique index (possibly the Primary Key) and you can assign a value programatically,  or get the last with a lookup.  You can store the last value somewhere,  for example in a table.  I worked on an "Enterprise" application that had 1 table with 1 row for each application table to hold the last value.  Not suggesting that,  since I thought it silly,  but you can go that route.  I've also seen another that had a table with 1 row per table with the last value.  Lock the record to enforce integrity.  It does serialize inserts.2)  make a compound key,  with say (assuming the value changes),  a char field containing the prefix,  and an int identity field.  Then build a view that casts them together as a char.There's more,  but this is off the top of my head.  Both have some performance impacts,  and the shape of your data and usage patterns will indicate the best path.</description><pubDate>Thu, 15 May 2008 07:39:53 GMT</pubDate><dc:creator>jgrubb</dc:creator></item><item><title>identity insql server</title><link>http://www.sqlservercentral.com/Forums/Topic500181-8-1.aspx</link><description>i want to put identity to a column bt tht column datatype must be varchar and tht identity must be starts with P001.pls help me                                                                        thank u</description><pubDate>Tue, 13 May 2008 23:15:48 GMT</pubDate><dc:creator>sunileadara1986</dc:creator></item></channel></rss>