GetNumsAB
A brand new, high-performing, "GetNumbers" or "fnTallyTable" function that can be used for defeating RBAR.
2020-07-02 (first published: 2016-03-23)
1,333 reads
A brand new, high-performing, "GetNumbers" or "fnTallyTable" function that can be used for defeating RBAR.
2020-07-02 (first published: 2016-03-23)
1,333 reads
I bet, each DBA would change some settings after the SQL Server installation as per their company standard . I wrote this PowerShell script for one of my client who has below standards: Port should be 1433, static Disable SQL telemetry* & SQLWriter services Change recovery model to FUll for all databases except tempdb and […]
2020-07-02 (first published: 2020-06-21)
2,598 reads
Lately, I'm dealing with lots of DB migrations and came across situation that I have no proper dynamic script to move DB files to different location. There are an option to proceed manually scripting one by one DB and execute it. Another option is detach attach DB - I'm not a big fan of this […]
2020-07-01 (first published: 2020-06-24)
1,762 reads
Insert multiple rows in the table using insert syntax which is the same as single insert rows. So, we have to use value likewise, single rows than there is the same process but include coma and insert the value of another row in your query. In this paragraph, we were given a syntax with insert […]
2020-06-29
1,259 reads
Avoid conversion errors when using UNION to stack rows from multiple tables.
2020-06-19 (first published: 2020-06-16)
3,811 reads
Check if the SPN is already registered: setspn -l domain\xxxxx If not, run below commands: setspn -A MSSQLSvc/abc.xx.companyname.com:1433 domain\xxxxx setspn -A MSSQLSvc/abc.xx.companyname.com domain\xxxxx setspn -A MSSQLSvc/abc:1433 domain\xxxxx setspn -A MSSQLSvc/ abc domain\xxxxx Verify again, setspn -l domain\xxxxx
2020-06-17 (first published: 2020-06-15)
7,206 reads
One of my client has the requirement to have SQL Service account running with domain account and should not be with local account. You may receive SSPI error after changing it to domain account. In order to fix that issue check my previous blog "How to register SPN for SQL service account" Output:
2020-06-17
1,031 reads
I have found this query valuable. Sometimes you need to see just overall consumption without any detailed information. It is also useful in overall trend analysis and disk space planning.
2020-06-16 (first published: 2020-06-12)
2,137 reads
I have created this script for one of our client, the requirement was all the databases should be in full recovery model and should be monitored. Also, I added other important parameters like AutoShrink, AutoClose etc. Output:
2020-06-16
1,101 reads
A couple of days ago I was playing with my small SQL Server enviroment (test) and auditting login events. I went ahead and created the audit for FAILED_LOGIN_GROUP and SUCCESSFULL_LOGIN_GROUP (let it run for a while). USE [master] GO CREATE SERVER AUDIT [Audit_LoginEvents] TO FILE ( FILEPATH = N'<PathToStoreData>' ,MAXSIZE = 100 MB ,MAX_FILES = […]
2020-06-03 (first published: 2020-05-27)
1,850 reads
I’m hosting a free webinar at MSSQLTips.com at the 19th of December 2024, 6PM...
By Steve Jones
I looked at row_number() in a previous post. Now I want to build on...
Recently I received a cry for help over Teams. The issue was that an...
Given the following table and query, this will return any records(based on message_id) that...
How to merge two tables with unlike fields. I have two table with one...
Hello, First of all, I find it odd/annoying that I can't exclude a Project...
I have this data in a SQL Server 2022 table:
player yearid team HR Alex Rodriguez 2012 NYY 18 Alex Rodriguez 2013 NYY 7 Alex Rodriguez 2014 NYY NULL Alex Rodriguez 2015 NYY 12 Alex Rodriguez 2016 NYY 9If I run this code, what are the results returned in the hrgrowth column?
SELECT player , yearid , hr , hr - LAG (hr, 1, 0) IGNORE NULLS OVER (ORDER BY yearid) AS hrgrowth FROM dbo.playerstats;See possible answers