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 …

Get System Downtime

Determine your Powershell exectuion policy 1Get-ExecutionPolicy Change your Powershell exectuion policy if restricted 1Set-ExecutionPolicy RemoteSigned Script to get system downtime 1234567891011121314151617181920212223242526272829303132333435363738[timespan]$downTime = New-TimeSpan -start 0 -end 0 [timespan]$totalDownTime = New-TimeSpan …

Determine Disk Size of Tables

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

Parse Simple XML C#

123456789101112131415string s @="<?xml version=""1.0"" encoding=""utf-8"" ?><Parent><Plate>ABC123</Plate></Parent>"; XmlDocument x = new XmlDocument(); x.LoadXml(s); XmlNode rootnode = x["Parent"]; if ((rootnode != null) && (rootnode.HasChildNodes)) {      XmlNodeList nodes = rootnode.ChildNodes;   …

VS2005 Build Warning “libbmt.pdb was not found”

Build Error in Visual Studio 2005: 123LIBCMT.lib(gshandler.obj) : warning LNK4099: PDB ‘libbmt.pdb’ was not found with  ‘C:\Program Files\Microsoft Visual Studio 8\VC\ce\lib\ARMV4I\LIBCMT.lib’ or at ‘c:\Source\AIMS Ticketer 4\Release\libbmt.pdb’; linking object as if …