Welcome to the new SQL Server 2008 forums!

Last Post 14 Nov 2008 08:08 AM by SQLUSA. 3 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
Jeff James
New Member
New Member

--
30 Oct 2008 03:52 PM
We've added a new SQL Server 2008 section (and related subcategories) to the SQL Server Magazine forums.

I've made the first post in this category, but feel free to be the first poster in the other categories!

- Jeff
SQLUSA
New Member
New Member

--
14 Nov 2008 08:08 AM
If you really want to get excited about SQL Server 2008, notice the C++ like T-SQL syntax below, like:
SET @sqlQuery += 'WITH NO_INFOMSGS' and the declaration line assignment.
---------------------------------------------------------------------------------------------

USE AdventureWorks2008;
GO
CREATE PROC sprocCheckDBAll (@InfoMessagesOn bit = null)
--ALTER PROC sprocCheckDBAll (@InfoMessagesOn bit = null)
AS
BEGIN
DECLARE @MAXDBID int = (SELECT MAX(dbid) FROM master.dbo.sysdatabases)
DECLARE @DatabaseID int = 1, @DatabaseName sysname = '';
DECLARE @sqlQuery nvarchar(512) = '';

WHILE (@DatabaseID <= @MAXDBID)
BEGIN
SELECT @DatabaseName = name FROM master.dbo.sysdatabases
WHERE dbid = @DatabaseID;
IF NOT ( @DatabaseName is null
OR @DatabaseName = 'master'
OR @DatabaseName = 'msdb'
OR @DatabaseName = 'tempdb'
OR @DatabaseName = 'model')
BEGIN
SET @sqlQuery = 'DBCC CHECKDB (' + @DatabaseName + ') '
IF (@InfoMessagesOn is null or @InfoMessagesOn = 0)
SET @sqlQuery += 'WITH NO_INFOMSGS'
PRINT @sqlQuery
EXEC sp_executesql @sqlQuery
END -- IF
SET @DatabaseID += 1; -- loop increment
END -- WHILE ;
END -- PROC
GO

EXEC sprocCheckDBAll
GO
--------------------------------------------------------------------------------------------------


Kalman Toth - Database, Data Warehouse & Business Intelligence Architect
SQL Server 2008 Training, SSAS, SSIS, SSRS: http://www.sqlusa.com/
SwePeso
New Member
New Member

--
17 Nov 2008 01:40 AM
I miss a lot of checks, for example

DATABASEPROPERTY( dbid, 'IsInRecovery') = 0

and so on...
SQLUSA
New Member
New Member

--
18 Nov 2008 03:39 AM
Peter,

You can submit your suggestions at : http://connect.microsoft.com/sqlserver

You need to drum up a support group though to push it...lots of competition what to include in next version...

Kalman Toth
http://www.sqlusa.com SQL Server 2008 Training


Acceptable Use Policy
---