change the inputs to dates
CREATE PROCEDURE my_sp_test
@start_date datetime,
@end_date datetime
or
try use the convert function
Exec("INSERT INTO #tmp_tbl1 SELECT * FROM tble_" + @ls_idno + " A WHERE ( CONVERT(datetime, A.date_added,101) >= '"+ "CONVERT(datetime, " + @start_date + ",101) +"') AND (CONVERT(datetime, A.date_added,101) <= '" + "CONVERT(datetime, " + @end_date + "101) + "' ) ")
--
just print the string and check for syntax....
cheers.
Main Topics
Browse All Topics





by: LowfatspreadPosted on 2003-09-23 at 11:59:13ID: 9415475
what values for the dates are you using....
and please show the sql statement as it exists before execution...