Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with a column

Status
Not open for further replies.

NickMalloy

Programmer
Apr 15, 2005
68
US
I have the following query where the inner select is creating an error saying "Syntax error converting the varchar value 'January ' to a column of data type int.
How can I fix this??

Select
title,
story,
startdate,
enddate,
(select monthName from tblMonths where datepart(month, tblArticles.startdate) = tblMonths.monthNumber) as monthName,
url,
islink
from tblArticles
 
Try changing...

datepart(month, tblArticles.startdate)

To...
Month(tblArticles.startdate)



-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
What is the datatype of tblArticles.startdate?
 
smalldatetime

I made the change like above and I am still recieving the same error
 
Fixed it. Data was in the wrong place in tblMonths.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top