SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Mar 2011
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Finding MAX value from emp_id column using SQL query?

    I need to select maximum of the Emp_id values from SQL server 2005 table.I was using the command which selects max value till 10 but after that it fails to pick max value of emp id from the table.(Actually it picks up Max value using by looking at 1st digit only,so till 9 its fine, but after that it shows 9>11 or 9>57 etc.So please tell me SQL query for finding max value in Emp id column.Thanx.
    MY sql query used:-
    Code:
    select MAX(emp_id) from table_name

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,406
    Mentioned
    149 Post(s)
    Tagged
    4 Thread(s)
    Change the column type of Emp_id in numeric.
    Right now it's alphanumeric, and that's why '9' > '11'.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •