Disable Intellisense for SQL files in Visual Studio
.sql files that are for reference only throw ‘errors’ in the VS error window. Since the sql files are not actually utilized within the program and also contain Oracle PL/SQL, …
.sql files that are for reference only throw ‘errors’ in the VS error window. Since the sql files are not actually utilized within the program and also contain Oracle PL/SQL, …
Determine if a decimal number can be converted to an INT without any loss of precision. Check if either of the rightmost two digits are non-zero 123substring(convert(varchar(10), a.DebitAmount), len(convert(varchar(10), a.DebitAmount)) …
Ensure the user has permission 123USE master; GRANT VIEW SERVER STATE TO username; GO Select from view sys.dm_os_sys_info 1select * from sys.dm_os_sys_info
To see the disk size of database tables in MSSQL: 12345678910111213141516171819202122SELECT t.NAME AS TableName, p.rows AS RowCounts, SUM(a.total_pages) * 8 AS TotalSpaceKB, …
123456789101112131415161718192021222324252627SELECT t.NAME AS TableName, i.name as indexName, p.[Rows], sum(a.total_pages) as TotalPages, sum(a.used_pages) as UsedPages, sum(a.data_pages) as DataPages, …
TSQL 123456–all tables and rowcount (in descending order by count) select ‘[‘+SCHEMA_NAME(t.[SCHEMA_ID])+’].[‘+t.NAME+’]’ AS [fulltable_name], SCHEMA_NAME(t.[SCHEMA_ID]) as [schema_name],t.NAME as [table_name] ,i.rows from sys.tables t INNER JOIN sysindexes i ON (t.object_id = …
To determine what tables contain row data 12345SELECT table_name, num_rows FROM all_tables WHERE owner IN (‘USER’) AND num_rows > 0 ORDER BY table_name;