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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-02-14 : 08:06:17
|
| Vijay writes "sir,I need a stored procedure/query which will accepts two dates sayfrom date and todate and one integr variable consists of two values either 5 or 6 means 5 dayweek or 6 day week... I need an output which should generated dayofweek for the day which is given from fromdate should dynamically generated weeks(depending on the integer variable value) till the todate comes..For example Input:Integer Value: 55 day week means from monday to friday6 dayweek means from monday to saturdayFrom date: 01/01/2005To date: 31/01/2005Output:26/12/2004(Mon)- 31/12/2005(Fri)3/1/2005(Mon)-07/01/2005(Fri)10/1/2005(Mon)-14/01/2005(Fri)17/1/2005(Mon)-21/01/2005(Fri)24/01/2005(Mon)-28/01/2005(Fri)31/01/2005(Mon)-04/02/2005(Fri)Its urgentexpecting quick replyVijay" |
|
|
clarkbaker1964
Constraint Violating Yak Guru
428 Posts |
Posted - 2005-02-14 : 13:51:23
|
Generate your sql into a variable the execute the sql with exec sp_executesql @sqlExample:declare @sql as nvarchar(255)set @sql = 'Select * from A Where datecolumn = ' + @inputvariableexec sp_executesql @sql You can do anything at www.zombo.com |
 |
|
|
|
|
|