SQLserver 更改计算机名
查看当前数据库服务器名称: use master go select @@servername select serverproperty('servername') 查看当前所有数据库服务器名称
网事随记
查看当前数据库服务器名称: use master go select @@servername select serverproperty('servername') 查看当前所有数据库服务器名称
查询不重复值总数 select count(distinct lieming ) from table where tiaojian=1 查询不重复值具体值 select distinct lieming from table where tiaojian=1
1、查询所有存储过程的名称以及定义 SELECT name, definition FROM sys.sql_modules AS m INNER JOIN sys.all_objects AS o ON m.object_id = o.object_id WHERE o.[type] = 'P'
SELECT AAA.host_name,BBB.* from Sys.dm_exec_Sessions AS AAA,( SELECT [session_id] , [request_id], [cpu_time], [start_time] AS '开始时间', [status] AS '状态', [command] AS '命令', dest.[text] AS 'sql语句',
RESTORE DATABASE DBNAME WITH RECOVERY
V