On Fri, Aug 27, 2010 at 11:43 AM, Stephen Russell <[email protected]> wrote:
> 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
ALTER TABLE dbo.LineToSay ADD
charnum AS replicate( '0', 10-len(convert( char(10),num)) )+
ltrim(rtrim(convert(char(10),num)))
GO
id num
charnum
0BF0E5D0-5D4E-46F3-B63F-FAA4B58E8281 1 0000000001
Would this work?
--
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.