Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Auto Populate CTE in SQL Server -


how can auto populate cte contain first day of every month eg:

1-1-2010
2-1-2010
3-1-2010
4-1-2010

and on. looking query so, rather using union operator.

have @ like

declare @startdate datetime,         @enddate datetime  select  @startdate = '01 jan 2010',         @enddate = '01 jan 2011'  ;with dates (         select  @startdate startofmonth         union         select dateadd(month,1,startofmonth) startofmonth            dates           dateadd(month,1,startofmonth) <= @enddate ) select  *    dates 

output

startofmonth ----------------------- 2010-01-01 00:00:00.000 2010-02-01 00:00:00.000 2010-03-01 00:00:00.000 2010-04-01 00:00:00.000 2010-05-01 00:00:00.000 2010-06-01 00:00:00.000 2010-07-01 00:00:00.000 2010-08-01 00:00:00.000 2010-09-01 00:00:00.000 2010-10-01 00:00:00.000 2010-11-01 00:00:00.000 2010-12-01 00:00:00.000 2011-01-01 00:00:00.000 

edit

with column name supplied

declare @startdate datetime,         @enddate datetime  select  @startdate = '01 jan 2010',         @enddate = '01 jan 2011'  ;with dates (dt) (         select  @startdate dt         union         select dateadd(month,1,dt) dt            dates           dateadd(month,1,dt) <= @enddate ) select  *    dates 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -