Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Number Series Increement

Author  Topic 

Kalaiselvan
Posting Yak Master

112 Posts

Posted - 2010-12-03 : 01:18:32
Hi,
We are using Dcoument Number as an UniqueId in our Table.

This Number will start as 00001..

In Page load this number will be Defaultly selected in a TextBox. So it must increase one by one and have to save as 00002,00003,00004 to 00010 to 00100 to 01000 to 10000.....

While taking the MAX value and if we add 1 to that value it shows me 2 but i need to show as 00002 and follows all..

Can anyone help me to fix this Issue..

Regards,
Kalaiselvan R
Love Yourself First....

stepson
Aged Yak Warrior

545 Posts

Posted - 2010-12-03 : 01:36:14
something like this maybe

REPLACE(STR(ISNULL(YourNumber, 0), 5), ' ', '0')
Go to Top of Page
   

- Advertisement -