MSSQL Blocked Queries

12345SELECT * FROM sys.dm_exec_requests CROSS APPLY sys.dm_exec_sql_text(sql_handle) where session_id IN (     SELECT blocking_session_id FROM sys.dm_exec_requests WHERE DB_NAME(database_id)=’AIMS’ and blocking_session_id <> 0 )

Oracle Managed Driver

1). Launch Visual Studio and install OMD – Click Tools > NuGet Package Manager > Package Manager Console – Type: Install-Package Oracle.ManagedDataAccess – Locate the dll Oracle.ManagedDataAccess.dll and copy it …

TSQL Determine Table Size

Determine the size of database tables in a MSSQL Server Database. 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647SELECT     DB_NAME() AS DatabaseNase ,     GETDATE() AS DateCreated ,     TableName,     Rows …

PL/SQL Determine Table Size

Original Source Link 1234567891011121314151617181920212223242526272829303132COLUMN TABLE_NAME FORMAT A32 COLUMN OBJECT_NAME FORMAT A32 COLUMN OWNER FORMAT A10 SELECT    owner, table_name, TRUNC(sum(bytes)/1024/1024) Meg FROM (SELECT segment_name table_name, owner, bytes  FROM dba_segments  WHERE …

TSQL is decimal an INT

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)) …

TSQL List all Columns in a Database

1234567891011121314151617Declare @Table_Name VarChar(100) ,@Column_Name VarChar(100) Set @Table_Name = ” Set @Column_Name = ” Select RowNumber = Row_Number() Over( PARTITION BY T.[Name] Order By T.[Name],C.column_id  ), SCHEMA_NAME( T.schema_id ) As SchemaName …