Blog Stats
- 401,691 hits
-
Prashanth Jayaram
DB Technologist, Author, Blogger, Service Delivery Manager at CTS, Automation Expert, Technet WIKI Ninja, MVB and Powershell Geek My Profile: https://social.technet.microsoft.com/profile/prashanth jayaram/ http://www.sqlshack.com/author/prashanth/ http://codingsight.com/author/prashanthjayaram/ https://www.red-gate.com/simple-talk/author/prashanthjayaram/ http://www.sqlservercentral.com/blogs/powersql-by-prashanth-jayaram/ Connect Me: Twitter @prashantjayaram GMAIL powershellsql@gmail.com The articles are published in: http://www.ssas-info.com/analysis-services-articles/ http://db-pub.com/ http://www.sswug.org/sswugresearch/community/
Personal Links
Verified Services
Top 30 PowerShell bloggers of 2018
My Blog is ranked amongst the Top 50 SQL blogs worldwide
DZone MVB
Microsoft
Archives
- January 2021 (1)
- October 2020 (1)
- June 2019 (1)
- May 2019 (2)
- April 2019 (1)
- March 2019 (1)
- January 2019 (3)
- December 2018 (8)
- October 2018 (3)
- September 2018 (5)
- August 2018 (1)
- July 2018 (9)
- June 2018 (5)
- May 2018 (8)
- April 2018 (5)
- March 2018 (6)
- February 2018 (1)
- January 2018 (4)
- December 2017 (3)
- November 2017 (3)
- October 2017 (5)
- September 2017 (3)
- August 2017 (3)
- July 2017 (3)
- June 2017 (3)
- May 2017 (3)
- April 2017 (1)
- March 2017 (4)
- February 2017 (1)
- January 2017 (3)
- December 2016 (1)
- November 2016 (2)
- October 2016 (2)
- September 2016 (2)
- August 2016 (3)
- July 2016 (6)
- June 2016 (2)
- May 2016 (9)
- April 2016 (12)
- March 2016 (4)
- February 2016 (2)
- January 2016 (6)
- December 2015 (2)
- August 2015 (1)
- March 2015 (3)
- February 2015 (3)
- January 2015 (5)
- December 2014 (4)
- November 2014 (3)
- October 2014 (1)
- September 2014 (1)
- August 2014 (1)
- July 2014 (1)
- June 2014 (1)
- May 2014 (2)
- April 2014 (4)
- March 2014 (4)
- February 2014 (5)
- January 2014 (8)
- December 2013 (2)
- November 2013 (1)
- October 2013 (2)
- September 2013 (6)
- August 2013 (5)
- July 2013 (6)
- June 2013 (6)
- May 2013 (9)
- April 2013 (16)
Top Posts & Pages
- The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
- PowerShell - Script to Monitor Disk Space of a Group of servers - HTML Formatted Email Output
- PowerShell - Script to Monitor a Service on a Group of servers - HTML Formatted Email Output
- Mailbox Statistics report with Email addresses
- T-SQL - Read CSV files using OpenRowSet
- SSAS - Find Cube Database Name, Size,Status and Total Size of SSAS Server
- PowerShell - Identify Service Account & Other Details of SQL Services - Multi Server Script
- T-SQL - Query to get Distinct,Sorted, Comma Separated values in to a variable
- PowerShell- Monitoring Multiple Services On Multiple Servers Using Win
- PowerShell - Export SQL Data to Excel with Powershell
Categories
- AlwaysOn (1)
- awards (2)
- Backup and Restore (14)
- Citrix (1)
- databases_files (2)
- docker (5)
- Exchange (2)
- FileProperty (1)
- GDPR (1)
- GENERAL (3)
- Graph database (1)
- JSON (4)
- Logshipping on Linux (1)
- MongoDB (16)
- NoSQL (1)
- Philosophy (1)
- PowerShell (64)
- Python (4)
- Robocopy (2)
- SCCM (1)
- Security (3)
- Vulnerability (1)
- SETVAR (2)
- sp_msforeachDB (1)
- sp_MSforeachtable (1)
- SQL (99)
- SQL 2012 (4)
- SQL 2016 (11)
- SQL 2017 (7)
- SQL 2017 on Linux (5)
- SQL and Python (1)
- SQL AZURE (2)
- SQL Indexes (1)
- SQL Joins (1)
- SQL On Linux (1)
- SQL Ops Studio (1)
- SQL Server 2017 (11)
- SQL Server Backup (10)
- SQL Server DevOps (1)
- SQL Server Tools (1)
- SQL Server vNext (2)
- SQL String (1)
- SQL tools (2)
- SQL XML (1)
- SQLCMD (3)
- SSAS (4)
- SSRS (3)
- String handling (2)
- sysfiles (3)
- T-SQL (37)
- Uncategorized (42)
- Variable Passing (1)
- XenApp VDA (1)
- XenDesktop VDA (1)
- XML (2)
- Follow Prashanth Jayaram on WordPress.com
- February 27, 2021The big day is here.
- The Big DayOctober 25, 2016The big day is here.
Category Archives: T-SQL
SQL Server 2016: JSON integration
Abstract This article helps to explain the application of JSON data and the use of new SQL 2016 constructs that enable an integration of JSON data into a relational schema. The idea behind this article is to list as many … Continue reading
SQL Server Operations: Monitoring Disk Space with WMI and OLE Automation Objects
Abstract This article talks about various SQL methods to fetch the disk usage details and use of T-SQL in conjunction with invoking OLE automation procedures and WMI class libraries using SQL Windows Shell interface. The step by step details about … Continue reading
Simple Methods to Recover master.mdf File Password
Overview MS SQL Server is the relational database management system used to store information in form of tables, views, indexes, triggers, constraints and stored procedures. Master Database File (MDF) is the main database file with the file extension .mdf used … Continue reading
Find failed SQL Job in last 24 Hours using Powershell
This post is based on the request to get failed SQL jobs in last 24 hours and output should be displayed in a HTML format. The verification of SQL job steps code is taken from the below blog. http://www.sqlservercentral.com/blogs/sqlsandwiches/2012/01/29/find-failed-sql-jobs-with-powershell/ The … Continue reading
Posted in PowerShell, SQL, T-SQL
Tagged Find SQL Failed Jobs, PowerShell to find failed SQL Jobs
12 Comments
SQL to generate Asset Information – Configuration Manager SCCM 2012
SELECT DISTINCT s.Netbios_Name0 AS ComputerName, s.Operating_System_Name_and0 AS OSName, pr.Name0 AS ProcessorTypeSpeed, pr.Manufacturer0 Manufacturer, pr.NumberOfCores0 Cores, pr.NumberOfLogicalProcessors0 LgicalProcessorCount, case when pr.DataWidth0=64 then ’64 bit’ else ’32 bit’ end DataWidth, m.TotalPhysicalMemory0/1024.00 AS MemoryMB, GS1.TotalVirtualMemorySize0 VirtualMemory, GS1.TotalVisibleMemorySize0 VisibleMemory, ip.IPAddress0, T1.COL AS TotalDriveSize, LastBootUpTime0, DATEDIFF(Day,GS1.LastBootUpTime0, GETDATE()) AS [Days since last boot] FROM v_R_System_Valid s INNER JOIN v_GS_PROCESSOR pr ON s.ResourceID = pr.ResourceID INNER JOIN v_GS_COMPUTER_SYSTEM gs ON s.ResourceID = gs.ResourceID INNER JOIN v_GS_NETWORK_ADAPTER ON s.ResourceID = v_GS_NETWORK_ADAPTER.ResourceID INNER JOIN v_GS_X86_PC_MEMORY m ON s.ResourceID = m.ResourceID INNER JOIN v_GS_NETWORK_ADAPTER_CONFIGURATION ip ON s.ResourceID = ip.ResourceID — INNER JOIN v_GS_LOGICAL_DISK AS ld ON s.ResourceID = ld.ResourceID INNER JOIN ( SELECT RESOURCENAME, col FROM ( SELECT DISTINCT TAB.Netbios_Name0 RESOURCENAME, ( SELECT COL.deviceid0 +’ ‘+ cast(COL.Size0/1024.00 AS varchar(20))+’ ‘ FROM v_GS_LOGICAL_DISK COL WHERE COL.ResourceID = TAB.ResourceID AND COL.DriveType0=3 FOR XML PATH (”) ) COL FROM v_R_System_Valid TAB )T where T.COL is NOT NULL ) T1 on T1.RESOURCENAME=s.Netbios_Name0 INNER JOIN V_GS_OPERATING_SYSTEM GS1 on GS1.ResourceID=s.ResourceID WHERE … Continue reading
T-SQL – Find Number of Rows of Database(s) tables Using Undocumented Procedure – sp_MSforeachdb and sp_MSforeachtable
Originally posted on Prashanth Jayaram:
On Technet forum, Op was looking for a way to get table cardinality for all databases in an instance. There are many ways to get the result. This post gives you an idea and SQL in which…
Posted in SQL, T-SQL
Leave a comment
T-SQL – Query to get Distinct,Sorted, Comma Separated values in to a variable
CREATE TABLE #temp(name char(3)) INSERT INTO #temp VALUES (‘CD’) ,(‘AB’) ,(‘LM’) ,(‘BC’) ,(‘GH’) ,(‘KJ’) ,(‘AB’) DECLARE @cols AS NVARCHAR(MAX); SELECT @COLS = substring(list, 1, len(list) – 1) FROM (SELECT list = (SELECT DISTINCT name + ‘,’ FROM #temp ORDER BY … Continue reading
T-SQL – Find Number of Rows of Database(s) tables Using Undocumented Procedure – sp_MSforeachdb and sp_MSforeachtable
On Technet forum, Op was looking for a way to get table cardinality for all databases in an instance. There are many ways to get the result. This post gives you an idea and SQL in which undocumented SP’s being called “sp_MSforeachdb and … Continue reading
Posted in sp_MSforeachtable, SQL, T-SQL
Tagged @whereand, get record count of all database into temp table, rebuild all indexes, sp_msforeach like clause, sp_MSForeachdb, sp_MSforeachdb and sp_MSforeachtable examples, sp_msforeachtable, sp_msforeachtable if clause, SQL, total record count, Total rows
1 Comment
T-SQL to Display Weekends Between two Dates
Different ways to find the weekend between two given dates. The SQL requires @begindate and @endate paramteters to be entered in the below SQL Download T-SQL WeekendBetweenTwoValidDates DECLARE @beginDate Date=’20150101′, @endDate Date=’20150131′ DECLARE @Calendar Table (CalendarDate Date Primary key, IsWeekend Bit) … Continue reading
Posted in T-SQL
Tagged calendar dates, Calendar Example, choose, choose example, DATEPART, Display Weekend, find weekends, T-sQL calendar dates, Table dataType
2 Comments
T-SQL :- How to Search String in all Stored Procedures across All User Defined Databases
There are many different ways to accomplish this tasks. Download Link https://gallery.technet.microsoft.com/T-SQL-How-to-Search-String-a1704fc6 The below examples uses undocumented sp’s to loop through all the user defined database to search the SP’s using given string CREATE TABLE #ProcSearch (databaseName VARCHAR(100),ROUTINE_CATALOG varchar(50),ProcName VARCHAR(128),RoutineType varchar(100),CreateDate … Continue reading →