3
Answers

need a help with datepart function

sa san

sa san

17y
5.1k
1

hi,

am having a dropdownlist of months(jan....dec). based on selection i wanted to retrive data from databse, but the field to check for a particular  month is  VDATE in  nvarchar(50). empty dates are inserted as 0, and inserted dates are 1/3/2007. i wanted to retrieve other data. how is it possible to check for a particular months. 

eg: select  details1,details2 from ctable where DATEPART(MONTH,VDATE)=@mnth

invalid cast operation

Answers (3)