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. 
    
        
            
                
                    
                        
                            
                                | Author | 
                                
                                 Topic  | 
                             
                            
                                    | 
                                         kamii47 
                                        Constraint Violating Yak Guru 
                                         
                                        
                                        353 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2008-10-09 : 05:09:28
                                            
  | 
                                             
                                            
                                            | I have a table, empno as a  field with text datatype..when i store the data it store like wise101102......999when i get maximum number it gets 999 correctly....after saving 1000th record the record store in the first like of the table, for ex,1000101102......999now am trying to get the maximum number it brings only the 999but in this case i need 1000 as a maximum number....What can i do for fetch the maximum record?[I know number field could be better to use but this question is asked by one of my friend and he probabaly can't change the field type at this stage]Kamran ShahidSr. Software Engineer(MCSD.Net,MCPD.net)www.netprosys.com | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     kamii47 
                                    Constraint Violating Yak Guru 
                                     
                                    
                                    353 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-10-09 : 05:26:53
                                          
  | 
                                         
                                        
                                          | Actually my customer has more than one site like 7005,7002 etc.,so am storing the value 7005/101 where 7005 is site id and 101 is reference numberif it is for 7002, we are storing 7002/101 like wiseso now what am doing is7005/1017005/102.............7005/999from the above am getting the the maximum onei wrote the query like that"select max(eno) from the table "it gives 7005/999after storing the next record  ie) 7005/1000am not able to get the maximum, that is 7007/1000  for this query "select max(eno) from the table "it fetch onle 7005/999....Kamran ShahidSr. Software Engineer(MCSD.Net,MCPD.net)www.netprosys.com  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     madhivanan 
                                    Premature Yak Congratulator 
                                     
                                    
                                    22864 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-10-09 : 05:54:26
                                          
  | 
                                         
                                        
                                          | Tryselect max(eno*1) from the tableMadhivananFailing to plan is Planning to fail  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     kamii47 
                                    Constraint Violating Yak Guru 
                                     
                                    
                                    353 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-10-09 : 06:22:57
                                          
  | 
                                         
                                        
                                          | I got data type mismatch in criteria ErrorKamran ShahidSr. Software Engineer(MCSD.Net,MCPD.net)www.netprosys.com  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     kamii47 
                                    Constraint Violating Yak Guru 
                                     
                                    
                                    353 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-10-09 : 06:47:36
                                          
  | 
                                         
                                        
                                          | select max(CLng(replace(id, '/','') ))  from employee workedKamran ShahidSr. Software Engineer(MCSD.Net,MCPD.net)www.netprosys.com  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |   
     
     
            
              
	     |  
		
			
     
          
		 |