2012年4月25日 星期三

{SQL} 將一 TABLE 複製


1.複製結構也複製資料
select * into NEWTABLE from OLDTABLE

2.只複製結構,不複製資料
select * into NEWTABLE from OLDTABLE where 1=0

3.將A table某欄位資料複製到B table某欄位
update B
set B's column= (select a's column  from A
 where A's column=B's column)

4.指定匯入某欄位的資料至新的資料表

SELECT a,b,c into NEWTABLE from OLDTABLE

5.匯入資料至「已存在」的資料表
Insert into NEWTABLE select * from OLDTABLE


參考資料:
http://goodmanroc.blogspot.tw/2011/07/t-sql.html
http://blogs.technet.com/b/technet_taiwan/archive/2012/05/28/t-sql-how-to-quickly-create-a-copy-of-a-table-using-transact-sql.aspx

{C#} maxItemsInObjectGraph 設定


設定 maxItemsInObjectGraph 值,預設值為:65536

<system.serviceModel>
<behaviors>
        <endpointBehaviors>
          <behavior name="abc">
            <dataContractSerializer maxItemsInObjectGraph="6553600" />
          </behavior>
        </endpointBehaviors>
      </behaviors>


    <client>
      <endpoint address="xxx.asmx  behaviorConfiguration="abc" />

    </client>

</system.serviceModel>


2012年4月24日 星期二

{C#} DateTime? 格式轉String與對DateTime加減時間

date為Datatime?型態->允許null格式
//1.先確定時間不為null
 if (date!=null)
                {
                    //2.先轉String
                    var strDate = string.Format("{0:yyyy\\/MM\\/dd HH:mm}", date);
                    //3.由String轉datetime
                    DateTime time = DateTime.Parse(strDate);
                    //4.加八小時
                    time=time.AddHours(8);
                    5.減八小時
                    time=time.AddHours(-8);
                    txtEndDate.Text = string.Format("{0:yyyy\\/MM\\/dd}", time);
                    ddlEndTime.SelectedValue = string.Format("{0:HH:mm}", time);
                }

參考資料:
http://www.dotblogs.com.tw/regionbbs/archive/2008/10/09/5636.aspx

2012年4月23日 星期一

{SQL} 搜尋當天資料

註:getdate()>>系統日期
select * from TABLENAME
where datediff(day,getdate(),TableColumn)=1


參考資料:
http://tw.myblog.yahoo.com/solong-tech/article?mid=1482&prev=1495&l=f&fid=35

2012年4月21日 星期六

{Knowledge}數值範圍

byte0 到 255
short-32768 到 32767
int:-2147483648 到 2147483647
float-3.402823E+38 到 3.402823E+38
long-9223372036854775808 到 9223372036854775807


參考資料:
http://tw.group.knowledge.yahoo.com/computer-computer/listitem/view?iid=3636

2012年4月20日 星期五

{JQuery} input控制項事件(持續更新:更新時間:4/20)

Text------

Blur() : 當物件失去forcus時
Change():當物件失去focus並且內容改變時
keypress():當控制項按下鍵盤鍵時(focus仍在)
keyup():當控制項按下鍵盤鍵「放開後」(focus仍在)
click():滑鼠點擊時
onPropertyChange():待測試


ex:$('.class').live('blur',function name)

select:-----
change():改變下拉選項時


參考網址:
http://www.dotblogs.com.tw/topcat/archive/2010/01/28/13383.aspx