SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 how to call excel file path dynamically in sql que
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kumarasari
Starting Member

India
2 Posts

Posted - 05/24/2013 :  23:59:28  Show Profile  Reply with Quote
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

Edited by - kumarasari on 05/25/2013 00:02:21

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 05/25/2013 :  09:41:47  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000