SQL SERVER 2000 T-SQL Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MrMob
    New Member
    • Jan 2010
    • 27

    SQL SERVER 2000 T-SQL Problem

    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
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    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

    Comment

    Working...