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.

sql server - MSSQL - Define a column name in SELECT statement then use that in WHERE clause -


is there way use defined column name in select statement clause? here t-sql codes,

select convert(datetime,(     case when operator = 't'          (substring(senddate,7,4)+'-'+substring(senddate,4,2)+'-'+          substring(senddate,1,2) + substring(senddate,11,9))      else          recivedsms.senddate      end)) defineddate  datepart(wk, defineddate) =  52 

yours affectionately , thank helps, now.

edited part of posted

create table #temp ( datefield datetime, numberfield varchar(10), sender varchar(255) )  insert #temp select distinct( convert(datetime, (                      case when operator = 't'                      (  substring( senddate, 7, 4 ) + '-'                             + substring( senddate, 4, 2 ) + '-'                             + substring( senddate, 1, 2 )                             + substring( senddate, 11, 9 )                          )                      else senddate                      end))) table1.datefield,  substring(table1.message,7,7) numberfield  table1 inner join  table2 on table1.sender = table2.phonenumber, (           select  convert(datetime, (                      case when operator = 't'                      (  substring( senddate, 7, 4 ) + '-'                             + substring( senddate, 4, 2 ) + '-'                             + substring( senddate, 1, 2 )                             + substring( senddate, 11, 9 )                          )                      else senddate                      end)) defineddate               table1 table1.operator not null         ) q   operator not null , substring(table1.message,1,6) = 'tree st'  , datepart( wk, q.defineddate ) =  52 , datepart(year, q.defineddate ) = 2010   select *  #temp order numberfield  drop table #temp 

not directly wrap in subselect.

sql statement

    select  *        (               select  convert(datetime, (                          case when operator = 't'                          (  substring( senddate, 7, 4 ) + '-'                                 + substring( senddate, 4, 2 ) + '-'                                 + substring( senddate, 1, 2 )                                 + substring( senddate, 11, 9 )                              )                          else recivedsms.senddate                          end)) defineddate                   yourtable             ) q                 datepart( wk, defineddate ) =  52 

update

i believe following equivalent wrote:

select  q.defineddate         , q.numberfield    (           select  sender                   , numberfield = substring(table1.message, 7, 7)                    , operator                   , convert(                       datetime                       , (                            case when operator = 't'                            substring( senddate, 7, 4 ) + '-'                                + substring( senddate, 4, 2 ) + '-'                                + substring( senddate, 1, 2 )                                + substring( senddate, 11, 9 )                           else senddate                            end )) defineddate               table1 table1.operator not null         ) q           inner join table2 on table2.phonenumber = tabl1.sender   q.numberfield 'tree st%'           , datepart( wk, q.defineddate ) =  52          , datepart( year, q.defineddate ) = 2010 

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 -