| Perfil de GregGreg Olsen - Yellow Duck...FotosBlogListas | Ajuda |
|
15 de agosto Microsoft Partner of the Year: Intergen !!Well last night was a great achievement for Intergen, collecting the award of Microsoft Partner of the Year. This comes just weeks after Intergen was awarded a member of the 2008 President's Club for Microsoft Dynamics. This is a great achievement rewarding our ongoing sales and development successes for Microsoft Dynamics products. Our Software + Services solution ActionThis also won the award of Software + Services Solution of the Year. Sign up at http://www.actionthis.com to start using this! Award Listing from last night:
Greg Olsen 10 de agosto SQL Server 2008 - RTM Now Available!Refresh All Views in Database with T-SQLThis is a handy little piece of code I wrote, which can help if you ever need to refresh your database views within SQL Server. I have tested this on SQL Server 2005 recently. I have also had a SQL Job run this stored procedure to update my views more frequently. I had used this to keep views up-to-date for database integration projects. 1: CREATE Procedure dbo.RefreshAllViews 2: AS 3: 4: DECLARE @ViewName nvarchar(max) 5: DECLARE @SQL nvarchar(max) 6: 7: DECLARE extensionViews CURSOR FOR 8: -- Get all views within the database 9: SELECT [name] As ViewName 10: FROM sys.views 11: 12: OPEN extensionViews 13: 14: FETCH NEXT FROM extensionViews 15: INTO @ViewName 16: 17: -- Check @@FETCH_STATUS to see if there are any more rows to fetch. 18: WHILE @@FETCH_STATUS = 0 19: BEGIN 20: 21: -- Build the dynamic SQL for updating the view on the fetched row 22: SET @SQL = 23: 'IF EXISTS (SELECT * FROM sysobjects WHERE type = ''V'' AND name = ''' + @ViewName +''') 24: BEGIN25: exec sp_refreshview N''dbo.'+ @ViewName + '''END' 26: 27: exec(@SQL) 28: 29: -- This is executed as long as the previous fetch succeeds. 30: FETCH NEXT FROM extensionViews 31: INTO @ViewName 32: END 33: 34: CLOSE extensionViews 35: DEALLOCATE extensionViews 36: 37: GOHope you find a use for this! |
|
|