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 |  
                                    | ElTerrible25Starting Member
 
 
                                        2 Posts | 
                                            
                                            |  Posted - 2008-09-15 : 17:29:13 
 |  
                                            | Hi...Im sorry if this doesnt fall into the correct category, but i am in a pretty big hurry.  I am trying to retrive the maximum bid id in table.  Then I want to increment the max id by 1 and insert a new record into the table.  When I try to run what I have below, there is a conversion from varchar to int error.  Should be a simple fix I would think.  Thanks for your help ahead of time.set ANSI_NULLS OFFset QUOTED_IDENTIFIER OFFGOALTER PROCEDURE [procedure]	@input FLOAT,ASSET NOCOUNT ONDeclare @BidID INTset @BidID = 'select TOP 1([BID-ID]) from table order by [BID-ID] DESC'INSERT INTO table([Bid-ID],input)VALUES(@BidID+1,  @input) |  |  
                                    | hey001usPosting Yak  Master
 
 
                                    185 Posts | 
                                        
                                          |  Posted - 2008-09-15 : 17:34:32 
 |  
                                          | Declare @BidID INT select TOP 1 @BidID = [BID-ID] from table order by [BID-ID] DESCINSERT INTO table([Bid-ID],input)VALUES(@BidID+1, @input)hey |  
                                          |  |  |  
                                    | ElTerrible25Starting Member
 
 
                                    2 Posts | 
                                        
                                          |  Posted - 2008-09-15 : 18:14:47 
 |  
                                          | much thanks! |  
                                          |  |  |  
                                    | visakh16Very Important crosS Applying yaK Herder
 
 
                                    52326 Posts | 
                                        
                                          |  Posted - 2008-09-16 : 00:04:28 
 |  
                                          | quote:will you be always inserting one record at a time? Also it would have been easier if you had defined identity property on Bid-ID column. This will get automatically incremented to next value for each inertion.Originally posted by ElTerrible25
 much thanks!
 
 |  
                                          |  |  |  
                                |  |  |  |