|
Posted by sunilkes on 11/07/07 17:17
Hello
I am a newbie to this, so I would appreciate any help, I am struggling
to get this to work
CREATE PROCEDURE [dbo].[sp_test]
@strfinalint as varchar(1000),
@startdate as datetime
@enddate as datetime
as
declare @insertcmd as varchar(2000)
declare @startdate as datetime
declare @enddate as datetime
set @insertcmd = 'INSERT INTO OPENROWSET(''Microsoft.Jet.OLEDB.
4.0'',''Excel 8.0;Database=d:\MyFolder\' + @strfinalint + ';'',
''SELECT * FROM [Sheet1$]'') Select * from tbltest WHERE S_Date
Between' + @startdate + 'AND' + @enddate
EXEC (@insertcmd)
GO
It was working with the command
set @insertcmd = 'INSERT INTO OPENROWSET(''Microsoft.Jet.OLEDB.
4.0'',''Excel 8.0;Database=d:\MyFolder\' + @strfinalint + ';'',
''SELECT * FROM [Sheet1$]'') Select * from tbltest'
But I am struggling to include the WHERE part of it, I seem to have
problems making the variables work in this with appropriate quotation
marks !!
Thanks
Sunny
Navigation:
[Reply to this message]
|