c# - Fetching date in SQL Server 2008 -
how split date in select query of sql server 2008 ? if feed feed current date in database , type of column in database date time store date time.if 1 want fetch date part column can do.
i can use query should not work.
select donorname, date(dateofdonation) dateofdonation createdonordetail;
it give error-
'date' not recognized built-in function name.
sql server 2008 has date
datatype - it's disabled if database upgraded sql server 2005, , didn't change database compatibility level.
check compatibility level this:
select name, compatibility_level sys.databases name = '-your-database-name-here-'
if compatibility level 90
, it's set sql server 2005 , won't able use date
. update compatibility level 100:
alter database adventureworks2012 set compatibility_level = 100
now should able use date
:
select donorname, cast(dateofdonation date) dateofdonation createdonordetail;
Comments
Post a Comment