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 this what u are looking for?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
$lastmenu=1;


//as a link:

$sLink=$fold."junk.php?thepage=$menu".($_GET['lev']+1);

if ($lastmenu > $_GET['lev'])
  echo "<p><a href=\"$sLink\">mydescription</a></p>";
else
  echo "this is the second part";
//as a button: /u could use either: a button with onclick event or a button as the a tag child.
if($lastmenu > $_GET['lev'])
  //echo "<p><input type=\"button\" onclick=\"document.location.href='$sLink'\" value =\"mydescription\"/></p>";  
  echo "<p><a href=\"$sLink\"><input type=\"button\" value =\"mydescription\"/></a></p>";
  
else
  echo "this is the second part"; 
//as a image
if ($lastmenu > $_GET['lev'])
  echo "<p><a href=\"$sLink\"><img src=\"\"></img></a></p>";
else
  echo "this is the second part"; 
Random Solutions  
 
programming4us programming4us