Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 day function

Author  Topic 

SQLS33ker
Starting Member

16 Posts

Posted - 2013-07-20 : 13:12:20
Hi there,

I read that DAY is an abbreviation to DATEPART().

I tried to use

select day('20121019').


The query didn't give me a result but it just says query executed successfully. How do I actually see the day as the result?

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-20 : 15:19:16
Nope...Thats wrong. I'm getting the result correctly ie 19

may be you're trying to assign this to variable and then not printing it back



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-07-20 : 16:36:56
quote:
Originally posted by SQLS33ker

Hi there,

I read that DAY is an abbreviation to DATEPART().

I tried to use

select day('20121019').


The query didn't give me a result but it just says query executed successfully. How do I actually see the day as the result?

Thanks

Is this happening only for the DAY function? Do you get correct results for other queries such as
select year('20121019');
select month('20121019');
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2013-07-21 : 02:25:34
quote:
Originally posted by SQLS33ker

Hi there,

I read that DAY is an abbreviation to DATEPART().

I tried to use

select day('20121019').


The query didn't give me a result but it just says query executed successfully. How do I actually see the day as the result?

Thanks



is there really a dot at the end of the statement ? remove it or change to semicolon ;

else you will get syntax error


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -