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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Declare @Actdate
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

2 Posts

Posted - 03/10/2013 :  19:55:30  Show Profile  Reply with Quote
Hi! I am new!
I am trying to figure out how I would change the bellow declare to get data from the 1st of March to the 31st of March 10, 2013. Does my question make sense?

Declare @Actdate varchar(20)
Set @Actdate = (Select DATEPART(yyyy, DATEADD(DD,-1,getdate()))*10000 + DATEPART(mm, DATEADD(DD,-1,getdate()))*100 + DATEPART(dd, DATEADD(DD,-1,getdate())))

Starting Member

2 Posts

Posted - 03/10/2013 :  20:19:29  Show Profile  Reply with Quote
*Date range 1st of March to 31st of March
Go to Top of Page

Flowing Fount of Yak Knowledge

2873 Posts

Posted - 03/10/2013 :  20:29:06  Show Profile  Reply with Quote
Your question doesn't make any sense, but I assume you want the beginning and ending of the current month?
declare @date date = getdate()
select DATEADD(month,datediff(month,0,getdate()),0)

Is Actdate really a varchar or a date?


Everyday I learn something that somebody else already knew
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.04 seconds. Powered By: Snitz Forums 2000