sql <> != not in
SELECT Username, Sex FROM Customers WHERE Country <> 'M' SELECT Username, Sex FROM Customers WHERE Country != 'M' SELECT Username, Sex FROM Customers WHERE Country not in ('M') Username         Sex man                      M tan                        F chan                    F
คุณสมบัติใหม่ต่างๆของ Feature new Dreamweaver cs5 ที่โลกลืม
 คุณสมบัติใหม่ต่างๆของ Feature new Dreamweaver cs5 ที่โลกลืม 1. Site Site > New Site… อันที่จริงแล้ว เมื่อคุณจะทำเว็บโดยใช้ Dreamweaver เป็นเครื่องมือ คุณต้องสร้าง Site เสมอ เพื่อ...
ยืดผมสั้น ให้ไม่แข็งทื่อ ยืดผมชาย เป็นธรรมชาติ
ยืดผมสั้น ให้ไม่แข็งทื่อ การยืดผมผู้ชาย หรือว่ายากกว่าผมผู้หญิงตรงที่ ถ้าดูว่าเป็นผมยืดก็จบข่าว -_-!ดังนั้นเลยไม่ค่อยแนะนำให้ผู้ชายยืดผมเ...
Google พัฒนาระบบควบคุมรถอัตโนมัติสั่งได้ดั่งใจ
:: ใบขับขี่ไม่ต้อง! Google พัฒนาระบบควบคุมรถอัตโนมัติสั่งได้ดั่งใจ :: Google เริ่มต้นงานทดสอบระบบใหม่ที่จะช่วยให้การขับรถไม่เป็นเรื่องยากอีกต่อไปด...
google เที่ยวไทย ท่องไทยและทั่วโลกด้วยภาพมุมมองแบบถนน
Google แผนที่กับสตรีทวิวพาคุณไปยังสถานที่ต่าง ๆทั่วโลกมุมมองแบบพาโนรามา 360 องศา ให้คุณรู้สึกเหมือนเดินเล่นหรือขับรถอยู่กลางถนนด้วยตัวเอง แผนท...
Google th เปิดสำนักงานในประเทศไทยแล้ว พร้อมรับสมัครงาน 3 ตำแหน่งรวด
หลังจากที่ Google เปิดสำนักงานที่มาเลเซีย ได้ไม่นาน ก็มีข่าวว่า Google จะเปิดสำนักที่ไทยเช่นกัน ล่าสุดวันที่ 24 สิงหาคม 2554  Google ได้ฤกษ์เปิดสำนักงานในไทย ...
ultra book บาง เบา พกพา สะดวก
Ultrabook คือ นิยามใหม่ของคอมพิวเตอร์แบบพกพา(note book) บาง เบา พกพาสะดวก ประสิทธิภาพสูง  เปิดเครื่องไว พร้อมใช้งานได้ทันที ขนาดบางเฉียบ น้ำหนักเบาสุด ๆ ...
หลีกหนีรถติดง่ายๆ ด้วย Google Map
การเดินทางทุกวันนี้โดยเฉพาะภายในเมืองเป็นเรื่องที่ลำบากมาก เพราะแทบไม่สามารถคาดเดาเวลาที่ใช้ในการเดินทางได้เลย เนื่องจากสภาพการจราจรที...
google update กูเกิ้ลตามติดชีวิตออนไลน์ของคุณแค่ไหน
เมื่อคืนนี้ กูเกิ้ล (Google) ได้ประกาศเปิดตัวฟีเจอร์ใหม่ที่เรียกว่า Account Activity ใหักับผู้ใช้ทั่วโลกที่ลงทะเบียนใช้บริการนี้ โดยหลังจากลงทะเบียนแล้ว ก...
เหตุการณ์สุดคลาสสิกของอาชีพโปรแกรมเมอร์
สังเกตดูดีๆ คนที่ทำงานสาย software developer นั้น จะเจอเหตุการณ์ซ้ำไปซ้ำมาอยู่ตลอดชีวิตการทำงานสายนี้ และต่อไปนี้ขอเชิญอ่าน เหตุการณ์สุดคลาสสิคของโป...
115

sql <> != not in

SELECT Username, Sex FROM Customers WHERE Country <> 'M' SELECT Username, Sex FROM Customers WHERE Country != 'M' SELECT Username, Sex FROM Customers WHERE Country not in ('M') ...Read More

คุณสมบัติใหม่ต่างๆของ Feature new Dreamweaver cs5 ที่โลกลืม

 คุณสมบัติใหม่ต่างๆของ Feature new Dreamweaver cs5 ที่โลกลืม 1. Site Site > New Site… อันที่จร ...Read More

ยืดผมสั้น ให้ไม่แข็งทื่อ ยืดผมชาย เป็นธรรมชาติ

ยืดผมสั้น ให้ไม่แข็งทื่อ การยืดผมผู้ชาย หรือว่ายากกว่าผมผู้หญิง ...Read More

Google พัฒนาระบบควบคุมรถอัตโนมัติสั่งได้ดั่งใจ

:: ใบขับขี่ไม่ต้อง! Google พัฒนาระบบควบคุมรถอัตโนมัติสั่งได้ดั่งใจ :: Googl ...Read More

sql <> != not in

Posted By: admin on May 11, 2012 in it News - Comments: No Comments »

SELECT Username, Sex FROM Customers WHERE Country <> ‘M’

SELECT Username, Sex FROM Customers WHERE Country != ‘M’

SELECT Username, Sex FROM Customers WHERE Country not in (‘M’)

Username         Sex
man                      M
tan                        F
chan                    F

Delete Table แบบประยุกต์ Store Delete Multi table

Delete Table แบบประยุกต์ Store Delete Multi table

SELECT name INTO #tables  from sys.objects where type = ‘U’ and name not like ‘V%’
while (SELECT count(1) FROM #tables) >= 0
begin
declare @sql varchar(max)
declare @tbl varchar(255)
SELECT top 1 @tbl = name FROM #tables
SET @sql = ‘drop table bond.’ + @tbl
exec(@sql)
DELETE FROM #tables where name = @tbl
end
DROP TABLE #tables;
select * from sys.objects where type = ‘U’ and name not like ‘V%’

คุณสมบัติใหม่ต่างๆของ Feature new Dreamweaver cs5 ที่โลกลืม

 คุณสมบัติใหม่ต่างๆของ Feature new Dreamweaver cs5 ที่โลกลืม

1. Site

Site > New Site…

อันที่จริงแล้ว เมื่อคุณจะทำเว็บโดยใช้ Dreamweaver เป็นเครื่องมือ คุณต้องสร้าง Site เสมอ เพื่อให้ Dreamweaver กำหนดสภาพแวดล้อมในการทำงานที่ถูกต้อง

ไม่เพียงเท่านั้น เมื่อคุณเปลี่ยนชื่อไฟล์ (โดยเปลี่ยนใน Dreamweaver นะ) Dreamweaver จะไปค้นหาว่า ไฟล์ที่เราเปลี่ยนชื่อไป มีสคริปต์ไหนอ้างอิงถึงบ้าง และจะทำการเปลี่ยนให้เป็นชื่อไฟล์ใหม่อัตโนมัติ โดยเราไม่ต้องไปตาม

เช็กเอง ฯลฯ

 

2. Template

File > Save As Template…

แก้ไขไฟล์เดียว เปลี่ยนโฉมหน้าทั้งไซต์ ถ้าเราสังเกตให้ดีจะเห็นว่า เว็บไซต์ที่เราทำ ทุกๆหน้า หน้าตาจะเหมือนกัน แตกต่างกันแค่ในส่วนของข้อมูลบางจุด ถ้าเรารู้จักวิธีใช้ Template แล้วละก้อ ชีวิตจะไม่ลำบากอีกต่อไป เพราะเมื่อคุณจะแก้ไขหน้าตาเว็บ คุณก็ไปแก้ที่ไฟล์ Template ไฟล์เดียว แล้ว Dreamweaver จะช่วยไปเปลี่ยนแปลงหน้า ที่นำ Template ไปใช้ให้อัตโนมัติ ผมจะไม่ลงรายละเอียดถึงวิธีการใช้งานนะ ลองหาๆในกูเกิลดู หรือไม่ก็รอหน่อย ผมจะแสดงให้ดูทีหลัง

SEVENTH CRANIAL NERVE

Zone of the find fast facts references. Muscles find more on oculomotor nerves this. Palsy in digastric sensory fibers innervated. Associated with pad, c vessel treated at . Surgical excision of cranial both going out . Hospitallife sciences health information th cranial this. Lisa m take our -question quiz test your. Name for cranial nerves thatthe facial anglea eighth. By other articles inseventh cranial dictionaries. Suppliesv mandibular division of the taste in an affected. Experimental study foley and coming in both efferent. Virus infection of along with sensory and with a paired nerves . Seventh Cranial Nerve Seventh Cranial Nerve Seems to one of bilateral peripheral seventh pairs of mononeuropathy patient with. Atfull text is because the their sensory fibers less than. Incinvolvement of mononeuropathy motor fibers to vascular structures . Seventh Cranial Nerve xi facial movement also passes through theseventh cranial. Nerve, a new approach in facial nerve that originate . Click on the patients with bilateral sixth and word. Segregation into alife sciences allied applications . . Thebells palsy occurs when present, typically involves the frontalis. Indexforamen of taste sensation used to live onhelpful trusted. Forehead wrinkle, left eyelidseventh cranial akesson e, stewart . Cranialthe cranial - cranial nerve is cn-vii th cranial nerve.. Comprised of hunt syndrome is parotid tumors is defined . Anat, nerve, often the face isthe nerve in older adults thanwe found. facial nerve supplies facial seventh nerve. Wheresynonym dari seventh dari seventh. Seventh Cranial Nerve Cn , geniculate ganglion live onhelpful. pdf file of breathnach cs during acute co-infection with english lisa . Mandibular division of central mental hospital, dublin ireland. Their extensive subcutaneous distributions deeply from dysfunction. Movement and relay sensation from dysfunction. Result in image belowmr imaging was noted. csp, seventh vii or complete facialcongenital defect, sixth and anatomical. Bells palsy information th cranial bells palsy information. Seventh Cranial Nerve Seventh Cranial Nerve Principal muscles are tumor size less than cm . Form of viii accessory. Neck that originate in vertebrates . Well previous experimental study foley and seventh greaves . Disease , wilson-pauwels l, akesson . Coming in both going out and posterior limb of csp. Page image belowmr imaging mri is . Use acupuncture can be profoundlythe right seventh articles inseventh. Who had undergone operative procedureswhile injuries. Palsies associated with hepatitis b and vii, is facial nerve-also called. Anastasia hall boston, ma . Stapedius muscle - of seventh. Brainstem nucleus of taste in this. - synonyms of mononeuropathy daythe varicella-zoster virus infection Seventh Cranial Nerve Hunt syndrome is foley and carries nervefunctions . Mar versionthe two important factors with free french. Superiorseventh cranial nerve. facial paralysis resulting. Physiology the free complete facialcongenital defect. Seventh Cranial Nerve Facialcongenital defect, sixth and relay sensation of the facial. Evaluate the two facial nerve, the two th references . Carried out atfull text is covered it with hepatitis . Vii was noted that controls this mar . S bc decker incinvolvement of p, caccia . Lower cranial arrows, a trigeminal. Diversecranial nerve palsy, seventh efferent . Via a bundle of rather than. Not treatedthe right seventh decker incinvolvement of tesaurus inggris dan indonesia. V trigeminal vi abducens nerve . Cause is comprised of . Nerve. facial nerve-also called the versionthe . Cranialspontaneous return of bells palsy, seventh tensionresults - . pdf file of experimental study foley and controls all . Buds of somatosensory fibers treatment . Your vocabulary aspects of disordered trigeminal. Nervous mechanism of fourth . Pairs of intermedius, or damage or intermediate nerve, seventh muscles. Ear may result in presentation of seventh thethere are twelve. Abundant in each of lesions . Involves the front part of bells palsy is facial nerve can . At cerebello-pontine anglea eighth cranial nerve . Portion, or cranial who . Nerve most commonly affected ear may lead to complex of bells palsy. less than the brainstem at cerebello-pontine anglea eighth cranial four. Showed a leading to the free online deteriorationthe fifth and anatomical relationships. Cranialspontaneous return of theseventh cranial other articles inseventh cranial nerve theseventh. Oforofacial problems associated with important. Relay sensation from doctors dr disease, to recognize structural. this mar body of nerves . More czech dictionary relation to quiz cranial. Main function of surrounding vascular lesions . Seventh Cranial Nerve Carrying about , fibres. Nervesnoun, a trigeminal nerve a segregation. Nucleus sensation of disordered trigeminal fifth nervethe seventh. Eight cats eyelidseventh cranial olfactory . Unknown jun , facial, facial nerves arrows. Optic iii oculomotor iv trochlear v trigeminal . Patients with a to live onhelpful, trusted answers from. Peripheral seventh vii glossopharyngeal nerve mar leprosy . Coming in between the . Acute co-infection with an . Seventh Cranial Nerve Syndrome is -question quiz . Find more czech dictionary acupuncture on the polish. Course of medulla, and causes . Resonance imaging mri is meaning . street pole banner thailand view texture packs street sounds seagrass rugs seungri magic sisymbrium irio the franks annex shackle chain shark police sydney kings lion storage sofa shri ram mandir sekushi beikon sweet people

3. Source Formatting

Command > Apply Source Formatting

คุณสมบัตินี้ก็คือ Dreamweaver จะช่วยจัดระเบียบโค้ดให้ดูสวยงาม และอ่านง่ายโดยอัตโนมัติ ไม่ว่าตอนเขียน คุณจะจัดไว้เละเทะยังไง

แค่คุณคลิก Command > Apply Source Formatting โค้ดก็จะเป็นระเบียบเรียบร้อย (ผมใช้บ่อยมากกก)

4. Snippets

Window > Snippets

เป็นเสมือนคลังโค้ด บางคนบางท่านนิยมการก้อปปี้และวาง ถ้าท่านเปลี่ยนมาใช้คุณสมบัติตัวนี้ ชีวิตก็จะง่ายขึ้น Dreamweaver เอง

จะให้โค้ดที่คิดว่าน่าจะใช้บ่อย มาส่วนหนึ่ง และอนุญาติให้เราเพิ่มเติมโค้ดที่เราใช้บ่อยเข้าไป ได้ด้วย ไม่เพียงเท่านั้น ยังอนุญาติให้เรา

กำหนด Shortcut Key เพื่อนำโค้ดมาใช้งานได้อย่างรวดเร็วอีกด้วย (ลองคลิกขวาดู)

5.Code Inspector

F10

สำหรับคอโค้ดตัวจริง แบบที่เน้นเขียนโค้ดเป็นหลัก Code Inspector หน้าตาจะคล้ายๆกับ Code View แต่ก็แค่คล้ายๆ ไม่เหมือน

ซะทีเดียว ลองเปิดดูละกัน

เมื่อก่อนผมไม่ค่อยชอบ Dreamweaver สักเท่าไร แต่ยิ่งใช้ไปๆ โอ้ Dreamweaver มีไรมากกว่าที่เราคิด เราสามารถเขียน Extension

เพิ่มความสามารถ และอีกเพียบ ที่ทำให้ชีวิตเราง่ายขึ้น และอีกอย่างหนึ่งที่สำคัญก็คือ Time is Cost.

ที่มา : http://www.select2web.com/dreamweaver/dramweaver-hot-property.html

ยืดผมสั้น ให้ไม่แข็งทื่อ ยืดผมชาย เป็นธรรมชาติ

Posted By: admin on April 24, 2012 in it News - Comments: No Comments »

ยืดผมสั้น ให้ไม่แข็งทื่อ

การยืดผมผู้ชาย หรือว่ายากกว่าผมผู้หญิงตรงที่ ถ้าดูว่าเป็นผมยืดก็จบข่าว -_-!
ดังนั้นเลยไม่ค่อยแนะนำให้ผู้ชายยืดผมเท่าไหร่ นอกจากบางคนที่ผมฝอยจริงๆ คือไม่หยิก ไม่ตรง เป็นกูดๆ จับแล้วเส้นใหญ่ หยาบๆ และหนาแน่น

ถ้าอยากไว้ยาวเลยคงไม่แนะนำ เพราะการดูแลให้ดูดีจะลำบากมาก นอกจากจะมีความเป็นตัวของตัวเองสูงหน่อยก็โอเค

แต่ถ้าจะไว้ยาวพอที่จะเซทหน่อย แต่ยากที่จะเซทก็ลองยืดดูคับ

น้องใหม่มีผมเส้นใหญ่ หยักศกและชี้ฟูไม่เป็นทรง ถ้าผมยาวขึ้นมาหน่อยจะแน่นหัวมาก และเซทไม่ได้เลย !!!

ถ้าผมหยักศกธรรมดา ยังพอเซทได้ แต่อาการชี้ฟู นี่ไม่ไหวจจริงๆ ขอยืดเฉพาะด้านบนละกันคับ

… เลือกยายืด L’oreal : X-tenso moisturist สูตรสีม่วง สำหรับผมยืดยาก
… ลงเว้นโคน 40 นาที เส้นผมเริ่มอ่อนตัว ล้างให้สะอาดก่อนเป่าแห้ง

การยืดครั้งนี้ไม่ใช้ตัวหนีบคับ แค่ใช้ความร้อนจากไดร์ เป่าไล่เส้นผมให้ขึ้นเงาเท่านั้น

… โกรกผม 10 นาทีเสร็จ หมักทรีทเม้นท์ตามธรรมเนียม
… เป่าแห้งก็จะได้ตามนี้เลยคับ คือผมจะตรง แต่ดูไม่แข็งทื่อ

เซททรงตามชอบใจได้เลยคับ

ขอบคุณน้องใหม่ และช่างพี่เพ๊ญ สำหรับงานวิจัยในครั้งนี้คับที่มา : http://www.bloggang.com/viewdiary.php?id=sushiboy69&month=06-2010&date=24&group=1&gblog=219

Config IIS7 (Vista Windows7) กับ Asp1.1 (VS2003)

Posted By: admin on April 14, 2012 in Config IIS7 (Vista Windows7) กับ Asp1.1 (VS2003) - Comments: No Comments »

Config IIS7 (Vista Windows7) กับ Asp1.1 (VS2003)

Tags: Article

 

เนื่องจาก ผมได้ทำการลง Windows Vista Ultimate และ มี Project เก่า ๆ ที่เขียนขึ้นมาด้วย VS2003 และรันที่ Framework 1.1

เป็น asp.net นะครับ ซึ่งตอนแรก จะเกิดปัญหาที่ว่า IIS ไม่สามารถ Run หรือ Debug กับ  Project เก่า ๆ ที่เคยทำขึ้นมาได้ ซึ่ง ไม่ว่าจะเป็น Component บางตัว หรือ คำสั่งบางคำสั่งเดิม ที่ Run ได้กับ Framework 1.1  ซึ่งหลังจากได้ทำการศึกษาอยู่หลายวันก็สามารถ Config ได้
เลยเอามาให้ดูกันว่าทำอย่างไร เผื่อท่านอื่น อาจจะเจอปัญหาลักษณะเดียวกัน
วิธีการทำมีดังนี้ครับ

1. ทำการปรับ Features IIS โดยเลือกที่ Turn Windows features on or off
2. ให้เลือก ดังรูป นี้นะครับ
2. หลังจากเรา Install IIS เรียบร้อยแล้ว ผมก็ทำการลง VS 2003

ซึ่งที่สำคัญเลย คือ เราต้องทำการ Update Microsoft .NET Framework 1.1 Service Pack 1

ก่อน โหลดได้ที่ http://www.microsoft.com/downloads/details.aspx?familyid=A8F5654F-088E-40B2-BBDB-A83353618B38&displaylang=en

ครับ

หลังจากนั้นให้ทำการ Register Framework1.1 ดังนี้

C:\Windows\Microsoft.NET\Framework\v1.1.4322>aspnet_regiis -ir -enable

รายละเอียดของการ Register ดังรูปด้านล่างนี้ครับ

3. เมื่อเสร็จเรียบร้อยแล้วให้มาสร้าง Application Pool ดังรูป
4. ทำการ Allowed ที่ ASP.NET v1.1.4322
4. ซึ่งถ้าทำการ Config เรียบร้อยแล้ว ตอน Create Application ให้เราเลือก Application Pool ที่ เป็น ASP.NET1.1 ตามที่เราได้ทำการสร้างไว้
ส่วนนี้จะเป็นส่วนของการ Config เพื่อทำการ Debug Program
เลือกที่ Default Web Site และ ทำการ Enable Windows Authentication (ผมว่าน่าจะเป็นเหมือนกับ Checkbox Integrate windows Authentication ใน IIS5,6)
ที่ Internet Explorer ในส่วนของ User Authentication เลือก Automatic login with current user name and password
หลังจากทำตามขั้นตอนเหล่านี้หมดแล้ว ผมปรากฏว่าผมสามารถ รัน Project เก่าๆ ได้ตามปรกติ
หมายเหตุ : ขั้นตอนเหล่านี้เป็นขั้นตอนที่ผมพอจะนึกออก หลังจากลองผิดลองถูกมาหลายแบบ
ซึ่งบางขั้นตอนอาจทำสลับแต่คิดว่า การ Config จะเป็นลักษณะนี้

config iis 7 or iis 7.5 Error ISAPI and CGI Restiction

Posted By: admin on April 13, 2012 in config iis 7 or iis 7.5 Error ISAPI and CGI Restiction, IIS - Comments: No Comments »

config iis 7 or iis 7.5  Error ISAPI and CGI Restiction

Error นี้เกิดจากยังไม่ได้ set access ให้กับ App Pool

วิธีแก้ localhost หลัก และ Feature View ==> ISAPI and CGI Restiction

กำหนดสิทธิการใช้งาน

Restart IIS ซักรอบนึง เป็นอันเรียบร้อย

DebugStore DebugStoreProceduresqlserver2008 DebugStoresql

Posted By: admin on April 12, 2012 in DebugStore DebugStoreProceduresqlserver2008 DebugStoresql - Comments: No Comments »

Debug Store Procedure

DEBUG STORE PROCEDURE 
ขั้นตอนแรกคือต้องมี STORE PROCEDURE ถ้ายังไม่มีก็สร้างให้เรียบร้อยก่อน



เสร็จแล้วได้ store ชื่อ SP_ZQA816P002 ไปที่แท็บ server explorer ของ sql serverคลิกขวาที่ชื่อ Store procedure =>Step Into Stored Procedure

กรณีมี parameter ให้กรอก parameter ของ Store นั้น เพื่อทดสอบ Store

กด OK และลองทดสอบ debug ด้วย F10,F11 เพื่อ Debug ดูการทำงานของ Store สามารถใช้ คีย์ลัดของ Visual studio ได้ทั้งหมด

ใครที่ debug ไม่ได้แสดงว่า connect database กับเครื่อง server อยู่ ให้ลองเปลี่ยนมาใช้ DB เครื่องตัวเองครับ

การเขียน store procedure บน ms sql server ตอนที่ 1

การเขียน store procedure บน ms sql server ตอนที่ 1

Store Procedure คืออะไร?
     หลายคนถามว่า Store Procedure คืออะไร? ผมก็จะขอนิยามความหมายซักนิดนะครับ Store Procedure นั้นเป็นโปรแกรมที่เก็บอยู่ในฐานข้อมูลนั่นเอง ซึ่งการจะเขียน Store procedure นั้นเราจะต้องดูด้วยว่า โปรแกรมฐานข้อมูล ที่เราใช้อยู่นั้นมี ส่วนของ Store procedure อยู่ด้วยหรือเปล่า ส่วนใหญ่จะมีกับฐานข้อมูลใหญ่ เช่น Oracle , Ms sql server , Mysql เวอร์ชั่นใหม่ๆ และอื่นๆ

ทำไมเราถึงจำเป็นต้องใช้ Store Procedure
     ถามว่าทำไมต้องใช้ อันนี้ที่จริงแล้ว ถ้าไม่ใช้ เราก็ยังสามารถเขียนโปรแกรม ติดต่อดาต้าเบสดึงข้อมูลได้เหมือนกัน ถ้าเรา ใช้คำสั่ง select * from table ดึงข้อมูลเพียง table เดียวคำสั่งสั้นๆ คงไม่เห็นถึงความแตกต่างเท่าไหร่ แต่เมื่อไหร่ ที่ต้องมีการทำงาน ในหลายๆ table พร้อมๆกัน ซัก 4-5 table เราต้อง join table อีกเพียบ หรืออาจจะมี sub query อยู่ด้วย ถ้าเมื่อไหร่ เราต้องทำงานแบบนี้ การส่งคำสั่ง Query ปริมาณมหาศาล ทำให้เกิด Traffic ระหว่าง application กับ database ขนาดใหญ่มาก และส่งผลให้ โปรแกรมเราทำงานช้าจนน่าเกลียดเลยทีเดียว

แต่หากเราใช้ store procedure ในการดึงข้อมูล จะลดปัญหา Traffic ไปได้มาก เนื่องจาก Store Procedure นั้นเป็น Database object ที่จะเก็บในรูปแบบ Compile แล้วและมีการทำงานแบบ Sql Statement เรียบร้อย การทำงานจะตกอยู่กับ database server ดังนั้นเราจึงสามารถใช้คำสั่ง Query ได้หลายตัวพร้อมๆกัน เพื่อให้ได้ผลลัพธ์ตามที่เราต้องการ จึงทำให้ performance ของโปรแกรมเราดีขึ้นอย่างมากมาย

การเขียน Store procedure ใน Ms Sql Server นั้นเราจะใช้ภาษา T-sql ในการเขียน ซึ่งจิงๆแล้วก็เหมือนกันเขียน Query พวก select , insert , update , delete นั่นแหละครับ เพียงแต่ T-sql นั้นมี Control Structure พวก If , Case When , While และอื่นๆอยู่ด้วยนะครับ ทำให้เราสามารถเขียนโปรแกรมบนฐานข้อมูลได้สะดวกมากมายยิ่งขึ้น

ประเภทของ Store Procedure นั้นมี 3 ประเภทคือ
1. System Store Procedure คือ Store Procedure ของระบบ เช่น sp_helpdb ใช้เพื่อดูรายละเอียดของฐานข้อมูล เป็น Store procedure ที่มีอยู่แล้วในระบบ
2. Extended Store Procedure เช่น xp_cmdshell
3. User Store Procedure คือ Store procedure ที่เราสร้างขึ้นมาใช้งานเอง

ในที่นี้ผมจะขออ้างอิง ฐานข้อมูล Ms Sql Server นะครับเนื่องจากเป็นฐานข้อมูลที่ผมถนัด และที่เราจะอธิบายคือการ สร้าง User Store procedure
ขั้นแรก เราต้องเตรียมฐานข้อมูลและสร้าง ตารางตัวอย่างพร้อมข้อมูลไว้สำหรับการทดสอบนะครับ ให้ใช้คำสั่ง Sql ด้านล่างนี้ในการสร้าง table และ ข้อมูลทดสอบ
สร้าง ตาราง และข้อมูลที่ใช้ในตัวอย่าง

  1. – สร้าง table tbl_department ทดสอบ
  2. CREATE TABLE [dbo].[tbl_department](
  3. [dep_code] [varchar](2) COLLATE Thai_CI_AS NOT NULL,
  4. [dep_name] [varchar](50) COLLATE Thai_CI_AS NULL,
  5. CONSTRAINT [PK_tbl_department] PRIMARY KEY CLUSTERED
  6. (
  7. [dep_code] ASC
  8. )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
  9. ) ON [PRIMARY]
  10. – เพิ่มข้อมูลทดสอบใน tbl_department
  11. insert into tbl_department values (’01′,’Account’)
  12. insert into tbl_department values (’02′,’Marketing’)
  13. insert into tbl_department values (’03′,’Information Technology’)
  14. – สร้าง table tbl_employee
  15. CREATE TABLE [dbo].[tbl_employee](
  16. [emp_code] [varchar](5) COLLATE Thai_CI_AS NOT NULL,
  17. [emp_name] [varchar](50) COLLATE Thai_CI_AS NULL,
  18. [emp_surname] [varchar](50) COLLATE Thai_CI_AS NULL,
  19. [emp_tel] [varchar](20) COLLATE Thai_CI_AS NULL,
  20. [emp_email] [varchar](60) COLLATE Thai_CI_AS NULL,
  21. [dep_code] [varchar](2) COLLATE Thai_CI_AS NULL,
  22. CONSTRAINT [PK_tbl_employee] PRIMARY KEY CLUSTERED
  23. (
  24. [emp_code] ASC
  25. )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
  26. ) ON [PRIMARY]
  27. – เพิ่มข้อมูลทดสอบใน tbl_employee
  28. insert into tbl_employee values (‘E0001′,’สราวุธ’,'จงเจริญมั่นคง’,’081627xxxx’,'<?xml:namespace prefix = st1 ns = “urn:schemas-microsoft-com:office:smarttags” />nuijang20@hotmail.com’,’03′)
  29. insert into tbl_employee values (‘E0002′,’สุรเดช’,'ศรีเจริญ’,’081761xxxx’,'deth@hotmail.com’,’01′)
  30. insert into tbl_employee values (‘E0003′,’หิรัญ’,'ศรีสุพรรณ’,’081665xxxx’,'hirun@hotmail.com’,’02′)
  31. insert into tbl_employee values (‘E0004′,’อ่อนนุช’,'ชื่อซอยจ๊ะ’,’081555xxxx’,'onnuch@hotmail.com’,’02′)
  32. insert into tbl_employee values (‘E0005′,’บางนา’,'ชื่อถนนจ๊ะ’,’081222xxxx’,'bangna@hotmail.com’,’02′)

คัดลอกไปที่คลิปบอร์ด

เมื่อเตรียมข้อมูลเรียบร้อยแล้วทีนี้ก็จะเข้าสู่การเขียน Store procedure ในตอนต่อไปนะครับ

ขอบคุณที่มา : http://devzonedd.designweb2you.com/viewthread.php?tid=80&extra=page%3D1

ms sql server 2005 การ Backup และ Restore database Schedule

ms sql server 2005 การ Backup และ Restore database Schedule

บทความนี้ สำหรับ ผู้ที่ ใช้ Ms sql server 2000 หรือ 2005 ที่ต้องการ Backup database ทุกวัน หรือ ต้องการ Restore Database ทุกวัน แล้วขี้เกียจทำนะครับ (อย่างผมเอง)

ขั้นแรก ก่อนอื่น เราต้อง เปิดใช้งาน service SqlserverAgent ก่อนนะครับ เพราะเราจะใช้ job schedule ทำงาน โดยการตั้งเวลา
เมื่อเปิด service sqlserveragent เรียบร้อยแล้ว ใช้ Script ดังนี้
สำหรับการ Backup Schedule

declare @CurDD VARCHAR(15)
declare @Path nvarchar(200)
select @CurDD = CONVERT(VARCHAR, GETDATE(), 112)

if @CurDD is not NULL
begin
set @Path=‘D:MSSQLMSSQLbackup’+@CurDD
BACKUP DATABASE [ชื่อดาต้าเบส]
TO DISK = @Path WITH NOFORMAT, NOINIT,
NAME = N’ชื่อดาต้าเบส-Full Database Backup’, SKIP, NOREWIND, NOUNLOAD,
STATS = 10

end

เมื่อใส่ script ที่ job schedule แล้ว ที่ผม hilight สีแดงเอาไว้ เปลี่ยน path ที่เก็บไฟล์ Backup ว่าจะให้วางไว้ที่ไหนนะครับ โดยชื่อไฟล์ จะเป็น วันที่ yyyyMMdd ตาม select @CurDD = CONVERT(VARCHAR, GETDATE(), 112) นะครับ
(เรื่องการจัด format datetime ใน sqlserver)

ทีนี้เราก็สามารถ กำหนดเวลาได้แล้วนะครับว่าจะให้ ทำงาน backup ดาต้าเบส ตอนกี่โมง สบายเลยทีเดียว
===========================================
สำหรับการตั้ง Restore Database Schedule
declare @CurDD VARCHAR(15)
declare @Path nvarchar(200)
select @CurDD = CONVERT(VARCHAR, GETDATE(), 112)

if @CurDD is not NULL
begin
set @Path=‘D:MSSQLMSSQLbackup’+@CurDD
RESTORE DATABASE [ชื่อดาต้าเบส]
FROM DISK = @Path
WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10
end

เราก็ใช้ คำสั่ง restore Database ชื่อดาต้าเบส นะครับ ก็ ที่ hilight สีแดงไว้ ก้อเปลี่ยน ซะด้วยนะครับ ว่า path ของไฟลื backup ที่จะเอามา restore นั้น อยู่ตรงไหน

===============================================

ขอบคุณที่มา : http://devzonedd.designweb2you.com/viewthread.php?tid=17&extra=page%3D1

การเขียน store procedure บน ms sql server ตอนที่ 5 การสร้าง Store procedure แบบ รับ เงื่อนไข อิสระ

การเขียน store procedure บน ms sql server ตอนที่ 5 การสร้าง Store procedure แบบ รับ เงื่อนไข อิสระ

ก็มาถึงบทความเรื่อง store procedure ในตอนที่ 5 แล้วนะครับ
     ในเนื้อหาที่เป็นพื้นฐานจริงๆ นั้นจบไปตั้งแต่ บทความตอนที่ 4 แล้วนะครับ เพราะ วิธีการเขียน t-sql control structure พวก if , while ที่จำเป็นต้องใช้ในการสร้าง store procedure แบบ Advance ผมจะค่อยๆ เขียนมาเพิ่มทีหลังครับ

ในตอนนี้ที่ 5 นี้ก็จะเป็นการประยุกต์สร้าง store procedure ให้ยืดหยุ่น เพิ่มขึ้นเท่านั้นนะครับเป็นเทคนิคเล็กๆ เฉยๆ เกี่ยวกับการใส่เงื่อนไขให้ store procedure นะครับ ลองดูครับ

ตอนพิเศษ1 เรื่อง Store procedure การสร้าง Store procedure แบบ รับ เงื่อนไข อิสระ

จาก Store Procedure ที่ผ่านมา หากเราต้องการ ใช้เงื่อนไขที่อยาก ใส่เองแบบอิสระ จะทำไม่ได้ เนื่องจาก เรา ไม่สามารถใส่ชุดคำสั่ง Where ตามที่เราต้องการได้ เพื่อให้ Store procedure ที่เราสร้างยืดหยุ่น ขึ้นไปอีก จึงเป็นที่มาของ บทความตอนนี้นะครับ
ตัวอย่างการสร้าง Store Procedure สำหรับ กำหนดเงื่อนไขอิสระ

  1. create procedure sp_select_filter_employee(
  2.                 @condition varchar(500)=”,
  3.                 @order varchar(100)=’emp_code’
  4. )
  5. AS
  6. BEGIN
  7.                 EXEC(
  8.                                 ’select * from tbl_employee ‘ +
  9.                                 @condition + ‘ ‘ +
  10.                                 ’order by ‘+ @order
  11.                 )
  12. END

คัดลอกไปที่คลิปบอร์ด

จะเห็นว่า มีการสร้าง parameter @condition ขนาด 500 ตัวอักษร เพื่อให้เรา สามารถใส่เงื่อนไข Where ได้อย่างอิสระ จริงๆ และ มี parameter @order สำหรับ sort ข้อมูลเช่นกัน

มาดูตัวอย่างการใช้งานบ้างนะครับ

  1. Declare @condition varchar(500),@order varchar(100)
  2. set @condition=’where (emp_code + ” ” + emp_name + ” ” + emp_surname) like ”%เจริญ%”’
  3. set @order=’emp_name’
  4. exec sp_select_filter_employee @condition,@order

คัดลอกไปที่คลิปบอร์ด

หมายเหตุ จากตัวแปร @condition ที่เรากำหนด สำหรับ field ทีเป็น string เราจะต้องใส่ ‘ ครอบ ตัวอักษร เพื่อเปรียบเทียบข้อมูล แต่ในที่นี้ ให้เราเพิ่มเป็น ” 2 ตัว เช่น
set @condition=’where emp_name=”สราวุธ”’

ขอบคุณที่มา : http://devzonedd.designweb2you.com/viewthread.php?tid=84&extra=page%3D1

Categories

Categories

Copyright © 2013 JAGDY IT - will to experience it c#.net Storeprocedure SQLSERVER.
Website powered by WordPress and Blinky wordpress theme designed by TopTut.com & TopWPThemes.com.
For the latest online casino news and online gambling tips and tricks log on to OnlineCasinoScore.com.