Syntax error converting datetime from character string.

Last Post 04 Feb 2010 08:53 AM by JASBRYDEN. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
JASBRYDEN
New Member
New Member

--
04 Feb 2010 04:41 AM
I have this script that I need to run, however I keep getting is error.

I check my data and I have no nulls.

Please help !!!



update asb_vsafcdt
set averagecost=(select averagecost from asb_averagecost
where
asb_averagecost.itemno=asb_vsafcdt.itemno and
asb_averagecost.[year]=asb_vsafcdt.forecast_year and
asb_averagecost.[month]=dateadd (mm,1,forecast_date) )
where exists
(select averagecost from asb_averagecost
where
asb_averagecost.itemno=asb_vsafcdt.itemno and
asb_averagecost.[year]=asb_vsafcdt.forecast_year and
asb_averagecost.[month]=dateadd (mm,1,forecast_date) )
JASBRYDEN
New Member
New Member

--
04 Feb 2010 08:53 AM
IF ('ASB_AVERAGECOST' IN (SELECT name FROM Sysobjects WHERE xtype = 'U') )
DROP TABLE ASB_AVERAGECOST
GO

CREATE TABLE [ASB_AVERAGECOST] (
[InvoiceDate] char (8) NOT NULL,
[Year] char(4) NOT NULL,
[Month] char (2) NOT NULL,
[ItemNo] char (20) NOT NULL,
[averagecost] decimal (11,2)NULL
)


Datepart would not work for me, since I want the month from table asb_average cost to be equal to the following month in column forecast_date which is part of table asb_vsafcdt.


You are not authorized to post a reply.

Acceptable Use Policy