On Fri, Aug 27, 2010 at 10:45 AM, Vincent Teachout <[email protected]> wrote: > This is my working solution, based on Stephen and Leland's suggestions. > Thanks, guys! > > USE [MyData] > GO > > -- Add an identity row to generate a unique number for each field > ALTER table [MyData].[dbo].[Claimant] ADD [testident] [int] > IDENTITY(1,1) NOT NULL > go > > -- update the actual uid field with a left padded string > update [MyData].[dbo].[Claimant] set uid = replicate( '0', > 10-len(convert( char(10),testident)) )+ ltrim(rtrim(convert( > char(10),testident))) > go > > -- and nuke the temporary identy column. > ALTER table [MyData].[dbo].[Claimant] Drop column testident > go ---------------------
Let me get this straight you have the int value and you want to pad "0000" to it. You could make a computed column for the table that does this for you. :) I have a column num and adding Charnum computed column -- Stephen Russell Sr. Production Systems Programmer CIMSgts 901.246-0159 cell _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

