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 2000 Forums
 Transact-SQL (2000)
 Finding Max of part of an integer

Author  Topic 

enak
Starting Member

34 Posts

Posted - 2006-03-30 : 12:54:52
I need to find the max value of part of an integer. the format of the integer is ####mmyy where mmyy is monthyear. The #### is a count that starts at 1 for the first entry of each month of the year.

I need to first find out if an entry exists for the current month. If one does then I need to find the max value of the #### part, then add 1 and then add the new record to the database.

I don't know how to do this.

Field Name: file_num int(4)

Thanks,
enak

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-03-30 : 14:22:06
[code]
select
max(MyCol)
from
MyTable
where
MyCol%10000 = 1206
[/code]

CODO ERGO SUM
Go to Top of Page

enak
Starting Member

34 Posts

Posted - 2006-03-30 : 14:50:53
Perfect. Thanks!
Go to Top of Page
   

- Advertisement -