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.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 how to call excel file path dynamically in sql que

Author  Topic 

kumarasari
Starting Member

2 Posts

Posted - 2013-05-24 : 23:59:28
Hi,all


we have using below query but not getting total records count pls give me any correct answer..

ALTER PROCEDURE [dbo].[TOTAL2]
(

@FILE_NAME varchar(100)
)
AS
BEGIN


DECLARE @TOTAL VARCHAR(100)='SELECT COUNT(*) FROM OPENROWSET(''Microsoft.ACE.OLEDB.12.0'',
''Excel 12.0;Database='+@FILE_NAME +';HDR=YES'', ''SELECT * FROM [Sheet1$]'')'



END

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-05-25 : 09:41:47
if your attempt is to return the total by executing the query, you need to use sp_executesql for executing it

see

http://support.microsoft.com/kb/262499

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -