Microsoft
Software
Hardware
Network
Question : sql
I am attempting to write a query that will loop through all the databases and rebuild all the indexes for each table.
I would like to use sp_msforeachtable and msp_msforeachdb
[code]
EXEC master..sp_MSForeachdb '
USE [?]
BEGIN
declare @starttime datetime
set @starttime = getdate()
print ''?''
EXEC sp_MSforeachtable @command1="DBCC DBREINDEX (''?'')"
declare @endtime datetime
SELECT @endtime = GETDATE()
INSERT INTO DBADB..MaintPlans values (getdate(), ''indexes'',db_name(), datediff(minute,@StartTime
, @EndTime))
END'
GO
[/code]
and i am receiving an error. is it possible to use both of these commands together? Also, i would like to include the fillfactor = 90% (DBCC REINDEX ( tablename, '', 90)
Any assistance you could provide would be great.
Answer : sql
>is it possible to use both of these commands together?
No, you cannot use both of them together
Random Solutions
Microsoft Dynamics GP 10 Not Responding during login - Hang
Need to open excel file through ASP Page(which is outside of App folder)
Disable Access 2007 security alert on terminal server 2003
Unable to query for computers in the network - Windows SBS 2008 Console
hotmail is blocking IP
Exchange 2007 SRV upgrade/migration to anthoer Exchange 2010 SRV gone wrong, what would you suggest guys
global variable username passthrough sql to generate a users work orders.
E-mail addresses missing from Outlook cache
MS SQL Server 2008 Express modifying field sizes
There is not enogugh memory to complete the automation object operation on the chart object