T-SQL query to copy data from one database to another database
T-SQL query to copy the rows of all the tables from one database to another database only if they have rows in Source DB and exact same Schema in...
2019-10-30
6 reads
T-SQL query to copy the rows of all the tables from one database to another database only if they have rows in Source DB and exact same Schema in...
2019-10-30
6 reads
T-SQL query to copy the rows of all the tables from one database to another database only if they have rows in Source DB and exact same Schema in...
2019-10-30
8 reads
T-SQL query to return the latest available database backup chain (Full, Differential and Log) of individual databases along with their backup size and compressed size.
2019-10-30
1 reads
T-SQL query to return the latest available database backup chain (Full, Differential and Log) of individual databases along with their backup size and compressed size.
2019-10-30
1 reads
T-SQL script to purge all the tables including foreign key references. The script has been made smart enough to use TRUNCATE wherever there is no foreign key reference and...
2019-10-30
2 reads
T-SQL script to purge all the tables including foreign key references. The script has been made smart enough to use TRUNCATE wherever there is no foreign key reference and...
2019-10-30
1 reads
PASS Summit 2019 starts up next Monday with pre-conference sessions. I’ve got my schedule all set, and I’m going to be busy: I’m speaking in two full-day pre-conference sessions,...
2019-10-30
3 reads
It’s been more than a year and a half since Robert Davis passed away. I wrote a bit about Robert’s passing last April. I haven’t written about him since,...
2019-10-25
1 reads
It’s just ten days until PASS Summit 2019 begins in Seattle. The schedule is up and there are loads of good sessions. Here’s what I’m putting on my calendar...
2019-10-24
2 reads
I am living the dream, y’all: yesterday I was finishing up my workday and needed to record a video, but realized that our puppy had spent enough time in...
2019-10-17
2 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