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 2005 Forums
 Transact-SQL (2005)
 Creating start date

Author  Topic 

jbphoenix
Yak Posting Veteran

68 Posts

Posted - 2009-07-29 : 12:43:08
I'm creating a report in reporting services and i'm using a date as a parameter. The date looks like this 20090729. I need to have my sql statement have a between 20080101 and 20090729 in there. How do I get my start date to be 20080101? So this is what I have but it doesn't work right.

between (left(@rptdate,4)-1) + '0101' and @rptdate

The way I have it the (left(@rptdate,4)-1) + '0101' ends up equaling 2109. So I guess I'm asking how to I combine 2008 and 0101?

jbphoenix
Yak Posting Veteran

68 Posts

Posted - 2009-07-29 : 12:56:25
convert(nvarchar(4),(left(20090630, 4)-1)) + '0101'
Go to Top of Page
   

- Advertisement -