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 |  
                                    | AskSQLTeamAsk SQLTeam Question
 
 
                                        0 Posts | 
                                            
                                            |  Posted - 2007-02-06 : 08:58:46 
 |  
                                            | Annie writes "HelloI want to import data from a text file to a database, my code looks likes the following. When I check if data is being imported, there is nothing in my database. What might be wrong with this code.ALTER PROCEDURE serverProcess_dataImportASdeclare @FilePath varchar(6000)declare @File varchar(6000)declare @sql varchar(6000)BEGINSET @FilePath = 'C:\Document and Settings\Desktop'SET @File     = 'Dekany.txt'select @sql = 'bulk insert tbl_siteSass from ''' + @FilePath + ''' , ''' + @File + ''' (fieldterminator='','')'  exec (@sql)exec serverProcess_dataImportENDGOSelect *from tbl_siteSass" |  |  
                                    | nrSQLTeam MVY
 
 
                                    12543 Posts | 
                                        
                                          |  Posted - 2007-02-06 : 10:58:30 
 |  
                                          | tryselect @sql = 'bulk insert tbl_siteSass from ''' + @FilePath + '\' + @File + ''' (fieldterminator='','')' And I'm pretty sure you don't want the recursuive callexec serverProcess_dataImport==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |  
                                          |  |  |  
                                |  |  |  |