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 |  
                                    | BenkuStarting Member
 
 
                                        10 Posts | 
                                            
                                            |  Posted - 2012-07-12 : 11:19:22 
 |  
                                            | Hi,i have the following sql query working in sqlSELECT [BatchLocation]  FROM [DBxx].[dbo].[tBatchContents]where [BatchID] = '41102.7768518519'when i include it into a vbscript and run the script i received the error telling me that an error occured converting nchar to numeric.the value 41102.7768518519 is coming from a variable from VBscript. so should i write some sort of sql code around it so that sql recognize the expected format? like a replace type of thing?help is appreciated. |  |  
                                    | jleitaoPosting Yak  Master
 
 
                                    100 Posts | 
                                        
                                          |  Posted - 2012-07-12 : 11:35:01 
 |  
                                          | are you converting the BatchLocation column? Are you sure that the problem is in BatchId column? |  
                                          |  |  |  
                                    | BenkuStarting Member
 
 
                                    10 Posts | 
                                        
                                          |  Posted - 2012-07-12 : 12:40:32 
 |  
                                          | well the batch ID is the only parameter i am trying to pass on the original sql query so i think this is what is causing te problem.now if you have any suggestion i am happy to give it a try. |  
                                          |  |  |  
                                    | BenkuStarting Member
 
 
                                    10 Posts | 
                                        
                                          |  Posted - 2012-07-12 : 12:42:01 
 |  
                                          | by the way i do get the error at the following liners.Open strSQL, cnSS |  
                                          |  |  |  
                                    | nigelrivettMaster Smack Fu Yak Hacker
 
 
                                    3385 Posts | 
                                        
                                          |  Posted - 2012-07-12 : 12:49:31 
 |  
                                          | What is strSQL?is it strsql = "SELECT [BatchLocation]FROM [DBxx].[dbo].[tBatchContents]where [BatchID] = " & mybatchidif so then change it tostrsql = "SELECT [BatchLocation]FROM [DBxx].[dbo].[tBatchContents]where [BatchID] = '" & mybatchid & "'"==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |  
                                          |  |  |  
                                    | jleitaoPosting Yak  Master
 
 
                                    100 Posts | 
                                        
                                          |  Posted - 2012-07-12 : 13:04:00 
 |  
                                          | Try the query and tell if you get an error:SELECT CONVERT(numeric(18,10), [BatchID])FROM [DBxx].[dbo].[tBatchContents]PS: sorry my bad english :s |  
                                          |  |  |  
                                    | jleitaoPosting Yak  Master
 
 
                                    100 Posts | 
                                        
                                          |  Posted - 2012-07-12 : 13:21:25 
 |  
                                          | One more test...SELECT [BatchLocation]FROM [DBxx].[dbo].[tBatchContents]where [BatchID] = REPLACE('41102.7768518519', '.', ',') |  
                                          |  |  |  
                                |  |  |  |