Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

[SQL Server 2008]SQL Server 2008 °²×°Ê¾ÀýÊý¾Ý¿â

ÏÂÔصØÖ·£ºhttp://msftdbprodsamples.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=19353
ÎÒÏÂÔصÄÊÇSQL2008.AdventureWorks_All_Databases.x86.msi£¬±¾²»ÏëÏÂÔØÕâÖÖ°²×°Îļþ£¬µ«½Å±¾Îļþ×ÜÊÇÖ´Ðгö´í£¬Ô­Òòû¾ßÌåÉ¡£ÕâÖÖ°²×°Îļþ°²×°ºó»á´´½¨Áù¸ö¿âAdventureWorks¡¢AdventureWorks2008¡¢AdventureWorksDW¡¢AdventureWorksDW2008¡¢AdventureWorksLT¡¢AdventureWorksLT2008¡£¿ÉÒÔ°ÑÕâЩ°²×°ºóµÄÊý¾Ý¿âÎļþ¶¼±¸·ÝÏÂÀ´ÁË£¬ÒÔ±ãÒÔºóÖØװϵͳʣµÄÔÙÓÃÄǸö°²×°Îļþ£¬Ö±½Ó¸½¼ÓÉϾͺÃÁË¡£
Ìáʾ£ºÔÚÓð²×°Îļþ°²×°µÄʱºò¿ÉÄÜ»á³öÏÖ£º "PrepInstance() failed for MSSQLSERVER. The following features are missing: Full Text Search. Fix the problems and re-run setup."ÕâÑùµÄÌáʾ£¬´ò¿ªWindows·þÎñ£¬ÕÒµ½SQL Full-text Filter Daemon Launcher (MSSQLSERVER)Õâ¸ö·þÎñ£¬ÉèΪÊÖ¶¯²¢Æô¶¯Ëü¡£Ôٴΰ²×°Ê¾ÀýÊý¾Ý¿âOK¡£
ÒÔÏÂתÔØ£º
AdventureWorks2008ÖÐʹÓÃÁËSQL2008µÄÐÂÌØÐÔFILESTREAM£¬ËùÒÔ±ØÐëÒªÆôÓøÃÌØÐÔ²ÅÄܹ»»¹Ô­Êý¾Ý¿â³É¹¦¡£¾ßÌåÆô¶¯FILESTREAMµÄ²Ù×÷ÈçÏ£º
£¨1£©ÔÚSSMSÖУ¬´ò¿ªÊý¾Ý¿âʵÀýµÄÊôÐÔ´°¿Ú£¬Ôڸ߼¶Ñ¡ÏÖн«“ÎļþÁ÷·ÃÎʼ¶±ð”ÉèÖÃΪÒÑÆôÓÃÍêÈ«·ÃÎÊ»òÕßÒÑÆôÓÃT-SQL·ÃÎÊ¡£È»ºóµ¥»÷“È·¶¨”°´Å¥¡£

£¨2£©ÔÚÅäÖùÜÀíÆ÷Öн«SQL Server·þÎñµÄFILESTREAM´ò¿ª£¬Èçͼ£º

£¨3£©ÖØÆôSQL Server·þÎñ£¬È»ºóÔÙ»¹Ô­AdventureWorks2008Êý¾Ý¿â¼´¿É¡£
ÁíÍâÁ½¸öʾÀýÊý¾Ý¿âÒ²½Ó×Å»¹Ô­¼´¿É¡£
AdventureWorks2008ÓëSQL2005µÄAdventureWorksÊý¾Ý¿âÓÐÒÔÏÂÌØÐÔÉϵIJ»Í¬£º
1.ΪÁËʹÓÃEntity Framework£¬ËùÒÔÌí¼ÓÁËPerson.BusinessEntityAddressÕâÑùµÄ±í¡£
2.ÔÚ±íHumanResources.EmployeeÖÐʹÓÃÁËhierarchyid µÄÊý¾ÝÀàÐÍ¡£
3.ÔÚ±íHumanResources.EmployeeÖÐʹÓÃÁËdateÀàÐÍ£¬ÔÚHumanResources.Shift±íÖÐʹÓÃÁËtimeÊý¾ÝÀàÐÍ¡£
4.ÔÚ±íPerson.AddressÖÐʹÓÃÁ˵ØÀí¿Õ¼äÊý¾ÝÀàÐÍgeography¡£


Ïà¹ØÎĵµ£º

SQL¸ß¼¶Ó¦Óà Garin Zhang

×·¼Ó£ºrow_number, rank, dese_rank, ntile
1. row_number: Ϊ²éѯ³öÀ´µÄÿһÐмǼÉú³ÉÒ»¸öÐòºÅ¡£
SELECT row_number() OVER(ORDER BY field) AS row_n
from tablename;
·ÖÒ³²éѯ£º
with t_towtable
as (select row_number over(order by field1) as row_number from tb)
select * from t_rowtable where row_numbe ......

SQL server µÚÈýƪ ¶à±íÁª½Ó²éѯ

        ¶à±íÁª½Ó²éѯ
Ò»¡¢¶à±íÁª½Ó²éѯµÄ·ÖÀà
¶à±íÁª½Ó²éѯʵ¼ÊÉÏÊÇͨ¹ý¸÷¸ö±íÖ®¼ä¹²Í¬ÁеĹØÁªÐÔÀ´²éѯÊý¾ÝµÄ£¬ËüÊǹØϵÊý¾Ý¿â²éѯ×îÖ÷ÒªµÄÌØÕ÷¡£
Áª½Ó²éѯ¿É·ÖΪÈý´óÀ࣬·ÖÁíΪ£º
1£®  ÄÚÁª½Ó¡£
2£®  ÍâÁª½Ó¡£
3£®  ½»²æÁª½Ó¡£
ÄÇôÎÒÃÇÒ»ÆðÀ´¿´Ò»ÏÂÈçºÎʹÓö ......

SQL SERVER ÈÕÆÚ¸ñʽ

³£Ó㺠Select CONVERT(varchar(100), GETDATE(), 8): 10:57:46
Select CONVERT(varchar(100), GETDATE(), 24): 10:57:47
Select CONVERT(varchar(100), GETDATE(), 108): 10:57:49
Select CONVERT(varchar(100), GETDATE(), 12): 060516 Select CONVERT(varchar(100), GETDATE(), 23): 2006-05-16 ......

SQLµÄ·ÖÒ³²éѯ

·ÖÒ³²éѯµÄÔ­Àí£º
 Õâ¸öÖ»ÄÜÓÃÔÙSql2005¼°ÒÔÉϵİ汾
DECLARE @pagenum AS INT, @pagesize AS INT  
SET @pagenum = 2   
SET @pagesize = 3   
SELECT *   
from (SELECT ROW_NUMBER()&n ......

SQL ¶àÐÐÖµºÏ²¢ÎªÒ»¸öÖµ

·½·¨(1)
SELECT stuff((select ','+ltrim(ColumnName) from #A for xml path('')
),1,1,'')
/*
102,103,104,105
*/
·½·¨(2)
DECLARE @s NVARCHAR(1000)='';
SELECT @s+=ColumnName+','  from #A;
SELECT @s; ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ