MS SQL SERVER 2000一些有用的T-SQL。
SQL Server 2000 的 DBCC 语句使用输入参数和返回值。所有 DBCC 语句参数都可以接受 Unicode 和 DBCS 字面值。
使用 DBCC 结果集输出
许多 DBCC 命令可以产生表格格式的输出(使用 WITH TABLERESULTS 选项)。该信息可装载到表中以便将来使用。以下显示一个示例脚本:
-- Create the table to accept the results
CREATE TABLE #tracestatus (
TraceFlag INT,
Status INT
)
-- Execute the command, putting the results in the table
INSERT INTO #tracestatus
EXEC ('DBCC TRACESTATUS (-1) WITH NO_INFOMSGS')
-- Display the results
SELECT *
FROM #tracestatus
GO
浙公网安备 33010602011771号