Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hello - I'm tying to create a SQL View that will allow users to query the data in excel file.I need help to write a script to pull this weeks data + 13 weeks ahead. I'm at a lost for the logic.I can't even supply an example of what I have been trying because I know I'm not even close.Can anyone shed some light on this for me?Regards,D-
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2012-01-31 : 13:18:38
use where condition like below
WHERE datefield >=DATEADD(wk,DATEDIFF(wk,0,GETDATE()),0)AND datefield <DATEADD(wk,DATEDIFF(wk,0,GETDATE())+14,0)
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/