Need help with distributed queries.


hi ,

iam new area , having hard time getting the query run can on please throw light 

part of sp tried import data excel sheet table in db run script never completes nor gives me error 

declare @vfilenamewithpath   varchar(100) 
        ,@vsql               nvarchar(3000) 


set @vfilenamewithpath = 'c:\clads\client list additions  records.xls'

set @vsql = 'insert clientlist_temp_testdba 
            ( account) 
            select  [account]
                  openrowset 
                  (''microsoft.ace.oledb.12.0'', 
                   ''excel 8.0;hdr=yes;database=' + @vfilenamewithpath + ''', 
                   ''select * [client list$]'')' 

print @vsql 

begin transaction

exec sp_executesql @vsql  

import import export wizard every thing works fine ,please help 

in advance.....

jack

hi jack,

i run query in machine. since mentioned  i run script never completes nor gives me error . excel file has a plentiful data? if there lots of data imported, query may execute slowly.

another thing need ensure table clientlist_temp_testdba should have column "account", , data in excel should meet datatype in sql server column.

in case of blocking, suggest commit current transactions before execute statement.

please try run following query directly see if succeed

insert clientlist_temp_testdba
( account)
select [account]
from openrowset
('microsoft.ace.oledb.12.0',
''excel 8.0;hdr=yes;database=c:\clads\client list additions records.xls',
'select * [client list$]')


best regards,
iric
please remember mark replies answers if , unmark them if provide no help.




SQL Server  >  SQL Server Data Access



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........