Insert Error: Column name or number of supplied values does not match table definition.



I am hoping someone has seen this before and/or can provide some insight...

I have a classic .asp web site that is running this sql against a SQL Server
2005 database:

set nocount on;

if object_id('tempdb..#TempChartData_410','U') is not null
Drop Table #TempChartData_410;

Create Table #TempChartData_410 (FromDate datetime, ToDate datetime);

declare @Diff int;
declare @BeginDate datetime;
declare @EndDate datetime;

set @BeginDate = cast('03/01/2006' as datetime);
set @EndDate = cast('05/20/2007' as datetime);
set @Diff = datediff(ww,@BeginDate,@EndDate);

while @Diff > 0
begin
set @EndDate = dateadd(ww, 1, convert(varchar(10), @BeginDate, 101));
insert into #TempChartData_410 values (@BeginDate, @EndDate);
set @BeginDate = @EndDate;
set @Diff = @Diff-1;
end


When run from my .asp page, this code generates the following error:

Microsoft OLE DB Provider for SQL Server error '80040e14'

Insert Error: Column name or number of supplied values does not match table
definition.


When run from Management Studio it runs just fine.

Anyone know what might be causing it, and how I can fix it?

Thanks!

/jason


.



Relevant Pages

  • Re: help with asp/sql convert data to date for comparison
    ... It must be MS SQL Server ... columns and store proper datetime values in a single column. ... Adjust that until you are creating proper datetimes. ... You should see data in the proper format. ...
    (microsoft.public.inetserver.asp.db)
  • Re: Date: Can you have one that is just mm/dd or mm/yyyy etc?
    ... If so, they are right, just display it with less resolution might be your ticket. ... they were thinking of there was mixed resolutions in one DATETIME column. ... One thing to watch is to NOT take my suggestion and print out everything ... determine if a day exists in it, and build the SQL accordingly. ...
    (comp.lang.java.programmer)
  • Re: Parameter??
    ... in common with most available SQL ... given month' Validation Rule or constraint? ... date_col DATETIME NOT NULL, ... The above relies on the Jet implementation to coerce a DATETIME to ...
    (microsoft.public.access.queries)
  • Re: Parameter??
    ... in common with most available SQL ... given month' Validation Rule or constraint? ... date_col DATETIME NOT NULL, ... The above relies on the Jet implementation to coerce a DATETIME to ...
    (microsoft.public.access.queries)
  • Re: Query Question for the Gurus
    ... datetime as an input parameter and returns the YYYYMMDDHHMM as a string ... select dOctets, myfunc, count ... I'm away from SQL or I could write a small test for you.... ... you could also do datefunctions which return a datetime datatype (rounded to ...
    (microsoft.public.sqlserver.programming)

Loading