SQL server 2005ѧϰ±Ê¼Ç(ÊÓͼ)
Ò»£®ÊÓͼ(VIEW)
¶¨Ò壺ÊÓͼÊÇÒ»ÕÅÐéÄâµÄ±í£¬ÆäÄÚÈÝÊÇ´ÓÒ»ÕÅ»ò¶àÕűíÖвéѯµÃÀ´µÄ½á¹û¼¯¡£
ÃèÊö£ºÊÓͼÊÇ´æ´¢ÔÚϵͳĿ¼ÖеÄÐÅÏ¢£¬Ëý²¢Ã»ÓÐÕæÕý´æ´¢Êý¾Ý£¬¶øÊÇÒÑ´æ±íµÄͶӰ¡£ÊÓͼµÄÊôÐÔÊÇ°´ÕÕÒ»¸ö²éѯµÄ¹æ¶¨´ÓÒ»¸ö»òÕ߶à¸ö±íÖе¼³öµÄ£¬ÊÇÒÑ´æ±íµÄ¹ýÂËÆ÷¡£ËýÊÇÒ»ÕÅ“Ðé±í”£¬´ÓÒ»Õűí»òÕ߶àÕűíÖÐÅÉÉú³öÀ´µÄ£¬ÆäÀ´Ô´³ÆΪ“»ù±í”£¬Ò²¿ÉÒÔ˵ÊÓͼÊÇÒ»ÕÅ“ÅÉÉú±í”¡£
×÷ÓãºÓû§¸ü¾ß×Ô¼ºÐèÒª£¬½¨Á¢ÊÓͼ¡£ÕâÑù¾Í¹ýÂ˵ôÁËÄÇЩ²»³£ÓûòÕßÓû§²»ÐèÒªµÄÊý¾Ý£¬ÈÃÓû§µÄ²Ù×÷¸ü¼ÓѸËÙ¡£ÆäÓŵ㣺
1.½µµÍÊý¾Ý¿âµÄ¸´ÔÓÐÔ¡£
2.¼¯ÖÐÓû§Êý¾Ý¡£
3.¼òµ¥¹ÜÀí¡£
4.×éÖ¯Êý¾ÝתÒƵ½ÆäËûÓ¦ÓóÌÐò¡£
5.Êý¾Ý±£ÃÜ¡£
¶þ£®ÊÓͼ½¨Á¢
CREATE VIEW <ÊÓͼÃû> [(<ÁÐÃû>[,<ÁÐÃû>]......)]
AS <×Ó²éѯ>
[WITH CHECK OPTION]
×Ó²éѯ¿ÉÒÔÊÇÈÎÒ⸴ÔÓµÄSELECTÓï¾ä£¬µ«ÊÇ×Ó²éѯÖв»ÄÜ°üÀ¨ORDER BYºÍDISTINCTÓï¾ä¡£
WITH CHECK OPTION ±íʾ¶ÔÊÓͼ½øÐÐUPTATA£¬INSERTºÍDELETE²Ù×÷ʱҪ±£Ö¤¸üС¢²åÈëºÍɾ³ýµÄÐÐÂú×ãÊÓͼ¶¨ÒåÖеÄΪ´ËÌõ¼þ(¼´×Ó²éѯÖеıí´ïʽ)¡£
Èý£®ÊÓͼ¹ÜÀí
1£®ÖØÃüÃûÊÓͼ
ʵÏÖ·½Ê½ÓÐÁ½ÖÖ£º
(1)ͨ¹ý sp_name
¸ñʽ£ºsp_name <ÔÊÓͼÃû>,<ÐÂÊÓͼÃû>
×¢Ò⣺´Ë²Ù×÷±ØÐëÔÚµ±Ç°Êý¾Ý¿âÖУ¬Ö»ÓÐÊý¾Ý¿âÓµÓÐÕߺ͹ÜÀíÕß²ÅÄܶÔÊÓͼ¸üÃû¡£
(2)ͨ¹ý¹ÜÀíÆ÷½øÐиüÃû¡£
2.ÊÓͼÐÞ¸Ä
¸ñʽ£º
ALTER VIEW <ÊÓͼÃû>
AS
SELECT ²éѯÓï¾ä
[WITH CHECK OPTION]
3.ɾ³ýÊÓͼ
¸ñʽ£º
DROP VIEW <ÊÓͼÃû>
×¢Ò⣺ÔÚɾ³ýÊÓͼºó£¬´ÓÕâ¸öÊÓͼÅÉÉú³öÀ´µÄÊÓͼ×Ô¶¯É¾³ý£¬µ«É¾³ýij¸ö±íºó£¬»ùÓÚÕâ¸ö±í´´½¨µÄÊÓͼ²»ÄÜ×Ô¶¯É¾³ý¡£
ËÄ£®ÊÓͼӦÓÃ
ÊÓͼӦÓõÄÔ¼Êø£¬ÏÂÁÐÇé¿öϲ»ÄܶÔÊÓͼ½øÐвÙ×÷£º
1.ÊÓͼÊôÐÔÀ´×Ô¾Û¼¯º¯Êý»òÕß°üº¬±í´ïʽ¡¢³£Á¿¡£
2.ÊÓÍ
Ïà¹ØÎĵµ£º
1.Stop ËùÓзþÎñ
2.Óà Windows Install Clean Up ¹¤¾ßжÔØSQL 2005×é¼þ
3.ÓÃSrvInstw.exeɾ³ýËùÓÐSQL·þÎñ
4.Çå³ý×¢²á±í
a. ½«HKEY_CURRENT_USER---Software----MicrosoftϵÄMicrosoft SQL ServerÎļþ¼ÐÈ«²¿É¾³ý
b. ½«HKEY_LOCAL_mACHINE---SOFTWARE---MicrosoftÏ ......
MySQLµ¼³öºÍµ¼ÈëSQL½Å±¾
µ¼³ösql½Å±¾£º
mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû > ´æ·ÅλÖÃ
mysqljump -u root -p test > c:\a.sql
µ¼Èësql½Å±¾£º
Òª½¨»·¾³±äÁ¿»òÕßÔÚbinµÄĿ¼Ï£¬mysqlÕâ¸öÃüÁî²ÅÄÜʶ±ð¡£
testÊÇÄãÒªµ¼½øÈ¥µÄÊý¾Ý¿âÃû×Ö£¬ÒªÌáÇ°½¨ºÃ~~
mysql -u Óû§Ãû -p Êý¾Ý¿âÃû < ´æ·ÅλÖÃ
mysqljump -u ro ......
ÔÚÍøÉÏÕÒÁ˺ܶ࣬×ÜÊDz»ÖªµÀÔõôÓã¬ÓÚÊÇ×Ô¼ºÐ´ÁËÒ»¸ö£º
declare @strHex char(5),
@len int,
@intOut int,
@i int,
@charint int
set @strHex = '20'
set @len = len(rtrim(@strHex))
set @i = 1
set @intOut = 0
while @i <= @len
begin
set @charint = case substring(upper(rtrim(ltrim(@strHex))) ......
--ÒÔÏÂÎÄÕÂΪתÔØ.
SQL×¢È멶´È«½Ó´¥——ÈëÃÅƪ
ZDNet Èí¼þƵµÀ ¸üÐÂʱ¼ä£º2007-08-20 ×÷ÕߣºCSDN À´Ô´£ºCSDN
±¾ÎĹؼü´Ê£ºÂ©¶´ SQL Server SQL
Ëæ×ÅB/SģʽӦÓÿª·¢µÄ·¢Õ¹£¬Ê¹ÓÃÕâÖÖģʽ±àдӦÓóÌÐòµÄ³ÌÐòÔ±Ò²Ô½À´Ô½¶à¡£µ«ÊÇÓÉÓÚÕâ¸öÐÐÒµµÄÈëÃÅÃż÷²»¸ß£¬³ÌÐòÔ±µÄˮƽ¼°¾ÑéÒ²²Î²î²»Æ룬Ï൱´óÒ»²¿ ......