This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
DB_NAME(mf.database_id) | |
,sum(fs.num_of_reads) as total_reads | |
from sys.master_files mf | |
cross apply sys.dm_io_virtual_file_stats(mf.database_id,NULL) fs | |
where mf.database_id = 2 | |
and mf.type_desc = 'ROWS' | |
group by mf.database_id | |
GO | |
CREATE TABLE #temp1 (col1 int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE PROCEDURE #spu_ObtenerTablasColumnas | |
AS | |
SELECT t.TABLE_SCHEMA, t.TABLE_NAME, COUNT(1) AS NUMERO_COLUMNAS | |
FROM INFORMATION_SCHEMA.TABLES t | |
INNER JOIN INFORMATION_SCHEMA.COLUMNS c | |
on t.TABLE_SCHEMA = c.TABLE_SCHEMA | |
and t.TABLE_NAME = c.TABLE_NAME | |
GROUP BY t.TABLE_SCHEMA, t.TABLE_NAME | |
ORDER BY 1,2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET STATISTICS TIME ON | |
DECLARE | |
@v1 int | |
,@v2 int | |
,@v3 int | |
,@v4 int | |
,@v5 int | |
,@v6 int | |
,@v7 int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @v int = 0 | |
SET @v = (SELECT database_id FROM sys.databases WHERE 1=2) | |
SELECT @v -- NULL | |
GO | |
DECLARE @v int = 0 | |
SELECT @v = database_id FROM sys.databases WHERE 1=2 | |
SELECT @v -- 0 | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @v INT | |
SET @v = 10 | |
PRINT @v | |
GO | |
DECLARE @v INT | |
SELECT @v = 10 | |
PRINT @v | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- roles | |
SELECT | |
us.name as userName, | |
us.authentication_type_desc, | |
'Role' as [PermissionType], | |
CAST(rol.name COLLATE Latin1_General_CI_AS_KS_WS as nvarchar(128)) as [Permission/Role], | |
CAST('' COLLATE Latin1_General_CI_AS_KS_WS as nvarchar(60)) as [class], | |
CAST('' COLLATE Latin1_General_CI_AS_KS_WS as nvarchar(60)) as [type], | |
CAST(null as sysname) as [ObjectName] | |
FROM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXEC sp_delete_database_firewall_rule | |
@Name=N'VMIPRule' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXECUTE sp_set_database_firewall_rule | |
@name = N'DummyIPRule', | |
@start_ip_address = '192.168.50.50', | |
@end_ip_address = '192.168.50.50' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXEC sp_delete_firewall_rule @name = N'MiRangoIPFalsas' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXEC sp_set_firewall_rule | |
@name = N'MiRangoIPFalsas', | |
@start_ip_address = '192.168.1.1', | |
@end_ip_address = '192.168.1.10' |