SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 day function
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

SQLS33ker
Starting Member

USA
13 Posts

Posted - 07/20/2013 :  13:12:20  Show Profile  Reply with Quote
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

India
52309 Posts

Posted - 07/20/2013 :  15:19:16  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

3557 Posts

Posted - 07/20/2013 :  16:36:56  Show Profile  Reply with Quote
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)

Singapore
17584 Posts

Posted - 07/21/2013 :  02:25:34  Show Profile  Reply with Quote
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
Time is always against us

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000