===== Ejemplos de comandos en SQL =====
==== Saber los usuarios y la ip que están conectados a una BDD ====
use base_de_datos
SELECT
conn.session_ID as SPID,
conn.client_net_address as IPAddress,
sess.host_name as MachineName,
sess.program_name as ApplicationName,
login_name as LoginName
FROM sys.dm_exec_connections conn
inner join sys.dm_exec_sessions sess
on conn.session_ID=sess.session_ID
where login_name <> 'usuario1' and login_name<> 'sa'
order by IPAddress
==== Obtener Fecha ===
Select convert (char(8), getdate(),112)
Select convert (char(10),convert(datetime,fecha),103)
Sp_help tabla da información sobre una tabla