By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,806 Members | 1,829 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,806 IT Pros & Developers. It's quick & easy.

SQL SERVER 2000 T-SQL Problem

P: 27
i have MAX CODE of 519999
and when i add 1 to this code.. it becomes 520000
Although i want to add only the rest 4 DIGIT(9999) to 1 NOT 51
so that it give me 5110000 (adding Dynamically)
I HAVE THE FOLLOWING Query.. Plz Help to Get the Desire Result..

@Branch=51
and Max CODE is 519999

SELECT @Code = @Branch + RIGHT(MAX(Code),@DIFAG) + 1
FROM tblmember (NOLOCK) WHERE LEFT(Code,2) = @Branch
Jan 21 '10 #1
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
Here are your options:

1. If you have a separate column for the Branch Code within your table, you don't need to include that on your CODE. You just concatenate them every time.
2. Use a calculated column
3. Use a trigger

Happy Coding!!!

~~ CK
Jan 21 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.