|
Posted by sunilkes on 11/09/07 10:59
Erland,
Thanks, this gets me closer to what I want to achieve, but because of
the @insertcmd being a varchar or nvarchar, I am having problems
filtering the dates.
CREATE PROCEDURE [dbo].[USP_Test]
@strfinalint as varchar(1000),
@startdate as datetime,
@enddate as datetime
as
declare @insertcmd as nvarchar(2000)
set @insertcmd = 'INSERT INTO OPENROWSET(''Microsoft.Jet.OLEDB.
4.0'',''Excel 8.0;Database=D:/MyDrive/' + @strfinalint + ';'',
''SELECT * FROM [Sheet1$]'') Select * from VwStaff WHERE S_Date
Between '''+ @startdate + ''' AND '''+ @enddate + ''' '
EXEC (@insertcmd)
GO
Am I doing something wrong? I tried using the @PARAMS but it does not
seem to work, so I tried the above, and now it tells me
Syntax error converting datetime from character string.
Sorry, but I am not too good at this.
Thanks
Sunil
Navigation:
[Reply to this message]
|