紅棗茶食譜

材料:1.苗栗公館出產的紅棗30顆(約1兩) 2.水一壺(約2000c.c.)3.糖適量(白砂糖、黃砂糖、冬瓜糖、黑糖皆可)4.其他材料:枸杞或桂圓(這可加可不加,紅棗茶單喝就很好喝了,兩種材料也都很對味喔。)

步驟一:將紅棗洗淨、撥開
步驟二:紅棗(連同枸杞)放入水中,開大火煮至滾後,靜置15分鐘(或轉小火悶煮30分)
步驟三:紅棗茶滾後,將糖放入。

資料來源:

http://blog.coa.gov.tw/index.php?op=ViewArticle&articleId=753&blogId=1

苗栗公館鄉農會(有販售紅棗服務)
200g/160元
聯絡電話:037-233-908(管小姐)

http://www.kkfa.org/list.php?func=product&id=20100315024538_D00_yenmin

SQL JOIN ON

Join on 內的篩選條件會影響Join內容,但不會影響Join總筆數。

Join 後的 where 條件則會影響Join總筆數,但Join內容不受影響。

例如:
table_a
id num
1 3
2 5
3 1

table_b
id num
1 9
2 8
4 10

select a.* , b.num
from table_a a left join table_b b
on a.id = b.id

id num num
1 3 9
2 5 8
3 1 null

select a.* , b.num
from table_a a left join table_b b
on a.id = b.id and a.num > 4

id num num
1 3 null
2 5 8
3 1 null
:原本可以對應出table_b id=1 ,num = 9的資料,但是因為在on子句內多加了 a.num > 4,導致table_a id = 1 , num = 3的資料不會去對應table_b id=1 , num = 9的資料。

select a.* , b.num
from table_a a left join table_b b
on a.id = b.id
where a.num > 4

id num num
1 3 9
2 5 8
3 1 null

id num num
2 5 8

SQL Server 寫入 Event Log的兩種方法

SQL provides us to make an entry in Event Viewer by two ways:
1. using XP_LogEvent

將使用者自訂訊息記錄在 SQL Server 記錄檔以及 Windows 事件檢視器中。xp_logevent 可以用來傳送警示而不傳送訊息給用戶端。

error_number:這是使用者自訂的錯誤號碼 (大於 50,000)。最大值是 2147483647 (2^31 – 1)。
‘message’:這是字元字串,最多 255 個字元。
‘severity’:這是下列三個字元字串之一:INFORMATIONAL、WARNING 或 ERROR。severity 是選擇性的,預設值是 INFORMATIONAL。

微軟備註
從 Transact-SQL 程序、觸發程序、批次等傳送訊息時,請利用 RAISERROR 陳述式來取代 xp_logevent。xp_logevent 不會呼叫用戶端的訊息處理常式或設定 @@ERROR。若要將訊息寫入 Windows 事件檢視器和 SQL Server 執行個體內的 SQL Server 錯誤記錄檔中,請執行 RAISERROR 陳述式。

2. Raiserror WITH LOG ()
RAISERROR(‘information’,15,3) WITH LOG; –寫入資訊等級為 資訊(<=15)
RAISERROR('warning',16,3) WITH LOG; –寫入資訊等級為 警告(=16)
RAISERROR(‘error’,17,3) WITH LOG; –寫入資訊等級為 錯誤(>16)

empty string in Oracle is Null

%請注意%
empty string in Oracle is Null
空白字串在Oracle資料庫中被視為Null值。
空白字串在SQL Server資料庫中被視為空白字串,和Null是不一樣的兩個物件。

Java環境安裝-Spring FrameWork

  • SpringSource Tool Suite 2.5.1
  • SpringSource tc Server 2.1.0
  • Spring Roo 1.1.0
  • Apache Maven 2.2.1

SQL Server 2000 RowID的作法 – 2

RowID為人工生成的排序序號。
如果移除 and employeeid = 39312這個篩選條件,則查詢時間會大幅增加。
原因在於最外層的查詢結果有292筆,那SELECT子句內的子查詢就會反覆查詢292次。
在加上 and employeeid = 39312 的查詢條件後 , 那麼子查詢就只會查詢一次。
可想而知,效率會有顯著提昇。

SELECT [EmployeeID]
      ,(select count(*) from [Test].[dbo].[Employees] as b
        where hiredate >= ’2009-05-01′ and hiredate <= ’2009-05-30′
        and b.employeeid <= a.employeeid
        ) as rowid
      ,[HireDate]
  FROM [Test].[dbo].[Employees] as a
  where hiredate >= ’2009-05-01′ and hiredate <= ’2009-05-30′
and employeeid = 39213
  order by employeeid

GridView BoundField DataFormatString設定

須加入 HtmlEncode = ‘False’ 後,在BoundField內的DataFormatString設定才會顯示效果。

數值格式設定參考:

  • 『{0:C}』 12345.6789 ==> $12,345.68
  • 『{0:C}』 -12345.6789 ==>($12,345.68)
  • 『{0:D}』 12345 ==>12345
  • 『{0:D8}』 12345 ==>00012345
  • 『{0:E}』 12345.6789 ==>1234568E+004
  • 『{0:E10}』 12345.6789 ==>1.2345678900E+004
  • 『{0:F}』 12345.6789 ==>12345.68
  • 『{0:F0}』 12345.6789==> 12346
  • 『{0:G}』 12345.6789==> 12345.6789
  • 『{0:G7}』 123456789 ==>1.234568E8
  • 『{0:N}』 12345.6789 ==>12,345.68
  • 『{0:N4}』 123456789 ==>123,456,789.0000
  • 『Total: {0:C}』 12345.6789 ==>Total: $12345.68

日期格式設定參考:

  • d 精簡日期格式 MM/dd/yyyy
  • D 詳細日期格式 dddd, MMMM dd, yyyy
  • f 完整格式 (long date + short time) dddd, MMMM dd, yyyy HH:mm
  • F 完整日期時間格式 (long date + long time) dddd, MMMM dd, yyyy HH:mm:ss
  • g 一般格式 (short date + short time) MM/dd/yyyy HH:mm
  • G 一般格式 (short date + long time) MM/dd/yyyy HH:mm:ss
  • s 適中日期時間格式 yyyy-MM-dd HH:mm:ss
  • t 精簡時間格式 HH:mm
  • T 詳細時間格式 HH:mm:ss

多對多資料表建立法(兩個資料表)

情境:一位作者寫多本書,一本書會有多名作者。

資料表開立方法:

  1. 作者資料表。(AuthorID , AuthorName , Sex , ContactPhone)
  2. 書籍資料表。(BookID , BookName , Price , ISBN , PublishDate)
  3. 作者書籍關係資料表。(AuthorID , BookID)

Function of [Click To Hide Or Show]

被隱藏的Div格式要設定:position : inherit。

否則關閉再開啟時,欄位名稱會消失。

<asp:Panel ID=』pnlKittingHistory』 runat=』server』 Visible=』false』>
                                <a href=』javascript:ShowChildGrid(‘divKittingOld’);』> 
                                <img id=』imgdivKittingOld』 alt=』Click To Show/Hide Old Version KittingList』 border=』0″ src=』../../images/arrow-top.gif』/>

function ShowChildGrid(obj) {
        var div = document.getElementById(obj);
        var img = document.getElementById(‘img’ + obj);
        var theFlag = div.style.display == 『inline』;
        div.style.display = (theFlag) ? 『none』 : 『inline』;
        img.src = (theFlag) ? 『../../images/arrow-bottom.gif』 : 『../../images/arrow-top.gif』;
    }

如何使用SSIS解壓縮檔案-By Execute Process Task & 7-Zip

  1. 使用7-Zip的Command Version。
  2. x –>解壓縮;-o –>指定解壓縮路徑的參數;-y –>強制覆蓋已存在檔案的參數
  3. 設定Execute Process Task時,記得要加入TimeOut參數,並當逾期時要能自動關閉Process,否則會出現轉檔很久卻無法成功的問題。
Follow

Get every new post delivered to your Inbox.