摘要: Declare @RandAry As Table( RandomInt Int)Declare @Count As IntDeclare @RandLoop AS Int = 0Declare @RandTotal As Int = 10Declare @RandNumber AS IntSelect @Count = Count(*) From dbo._cache_vLocationLookup(NOLOCK)While @RandLoop < @RandTotal Begin Set @RandNumber = Ceiling(Rand()*@Count) Insert Into 阅读全文
posted @ 2012-05-25 22:29 Allen Xu 阅读(104) 评论(0) 推荐(0) 编辑
摘要: WITH perms_cte as(select USER_NAME(p.grantee_principal_id) AS principal_name,dp.principal_id,dp.type_desc AS principal_type_desc,p.class_desc,OBJECT_NAME(p.major_id) AS object_name,p.permission_name,p.state_desc AS permission_state_desc from sys.database_permissions pinner JOIN sys.database_principa 阅读全文
posted @ 2011-08-31 16:15 Allen Xu 阅读(190) 评论(0) 推荐(0) 编辑
摘要: SELECT DATEPART(YEAR,CreateTime)AS 'Year', DATEPART(week,CreateTime)AS 'Week', MIN(DATEADD(week,DATEDIFF(week,0,CreateTime),0))AS 'Week Date', SUM(COALESCE(Amount,0))AS 'Order Amount', SUM(COALE... 阅读全文
posted @ 2011-05-13 09:32 Allen Xu 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Pull fragmentation statistics: SELECT OBJECT_schema_NAME(a.OBJECT_ID)+'.'+OBJECT_NAME(a.OBJECT_ID)ASObjectName, a.OBJECT_IDASObjectID, a.index_idASIndexID, b.nameASIndexName, a.avg_fragmentation_... 阅读全文
posted @ 2011-04-27 13:41 Allen Xu 阅读(174) 评论(0) 推荐(0) 编辑
摘要: DBCCDBReindex(TableName, '',90) Or ALTERINDEXALLONTableNameREBUILDWITH (FILLFACTOR=90,SORT_IN_TEMPDB=ON,STATISTICS_NORECOMPUTE=OFF,ONLINE=OFF); 90 Refers to page density 90%, 10% is reserved for updat... 阅读全文
posted @ 2011-04-27 13:20 Allen Xu 阅读(204) 评论(0) 推荐(0) 编辑
摘要: USEDatabaseName Go --Get DB/LOG fileid and name SELECTfile_id,name FROMsys.database_files; GO --Check if there is old active transaction preventing shrinking db log DBCCOPENTRAN(DatabaseName)WITHTabl... 阅读全文
posted @ 2011-04-23 09:41 Allen Xu 阅读(267) 评论(0) 推荐(0) 编辑
摘要: <scripttype="text/javascript"> varSys={}; varua=navigator.userAgent.toLowerCase(); vars; (s=ua.match(/msie([\d.]+)/))?Sys.ie=s[1]: (s=ua.match(/firefox\/([\d.]+)/))?Sys.firefox=s[1]: (s=ua.match... 阅读全文
posted @ 2011-04-13 11:52 Allen Xu 阅读(144) 评论(0) 推荐(0) 编辑
摘要: For large form with tons of editor controls, if user does not finish the input before it’s timeout, user will have to fill the form again from scratch. That would be frustrating :( A user-friendly workaround is to prompt user the choice to give up intermediate result or save it, when user tries to s 阅读全文
posted @ 2011-04-03 16:20 Allen Xu 阅读(348) 评论(0) 推荐(0) 编辑