Month: May 2019

Find out when last bakcup was restored in SQL Server DB

Posted on Updated on

Sometime we may need to find out which date some perticular database was restored and by whom? Use following query to find out this information.

WITH LastRestores AS ( SELECT DatabaseName = [d].[name] , [d].[create_date] , [d].[compatibility_level] , [d].[collation_name] , r.*, RowNum = ROW_NUMBER() OVER (PARTITION BY d.Name ORDER BY r.[restore_date] DESC) FROM master.sys.databases d LEFT OUTER JOIN msdb.dbo.[restorehistory] r ON r.[destination_database_name] = d.Name ) SELECT * FROM [LastRestores] WHERE [RowNum] = 1

The log or differential backup cannot be restored because no files are ready to rollforward

Posted on Updated on

Sometimes with restoring backups in SQL Server Database you may end up by getting this error:

Msg 3117, Level 16, State 1, Line 1
The log or differential backup cannot be restored because no files are ready to rollforward.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

You may usually receive this error while restoring a Differential Backup, in a situation when you haven’t restored FULL Backup OR you have restored Full Backup without “WITH NORECOVERY” option.


All you need to do is First restore FULL Backup with NORECOVERY option then restore a differential backup with “RECOVERY” option.

A Simple example is given below:

RESTORE DATABASE AdventureWorks FROM DISK = 'D:\AdventureWorks_Full.bak' WITH NORECOVERY RESTORE DATABASE AdventureWorks FROM DISK = 'D:\AdventureWorks_Diff.bak' WITH RECOVERY

The Genesis Block: The proof of work

Posted on Updated on

Bitcoin is a global phenomenon that has taken over the globe. Funny Money is no longer a laughing matter. After years in the background the founders and visionaries emerge with a team of stellar innovators to set the record straight about the past and the future. Satoshi Nakamoto the visionary team shows us why there can only be one truth in time which is immutable.Knowing they could trust no one around them, they left their identification mark on the actual code itself to be retrieved as Id when they returned. They stunned the world to show the power of a decentralized system in real time. Like the Voynich code Satoshi Nakamoto and the team around them seek to preserve their legacy in plain view. See if you can find the secrets they leave behind in many forms. Follow the journey from the beginning and see how much went into creating a platform designed with the guidance of nature itself is surpassing modern technology to create an amazing future. Data embedded in the past becomes immutable in the future when retrieved and the keys of decryption display the message left by those who encrypted it. If we claim to be cryptographers and do not have anything encrypted it seems we are not worthy of the name. In the future our generations will look back at those who fought to hold on to the old ways as barbaric. Once we used an outhouse and today we have a modern sanitary system that has cut down many diseases; this is how we view the system we built to clean up the corruption in a system that could not regulate itself. Onward. Buy This Book

Hands-On Data Science with SQL Server 2017: Perform end-to-end data analysis to gain efficient data insight

Posted on Updated on

by Marek Chmel  (Author), Vladimir Muzny  (Author)

Find, explore, and extract big data to transform into actionable insights

Key Features

  • Perform end-to-end data analysis―from exploration to visualization
  • Real-world examples, tasks, and interview queries to be a proficient data scientist
  • Understand how SQL is used for big data processing using HiveQL and SparkSQL

Book Description

SQL Server is a relational database management system that enables you to cover end-to-end data science processes using various inbuilt services and features.

Hands-On Data Science with SQL Server 2017 starts with an overview of data science with SQL to understand the core tasks in data science. You will learn intermediate-to-advanced level concepts to perform analytical tasks on data using SQL Server. The book has a unique approach, covering best practices, tasks, and challenges to test your abilities at the end of each chapter. You will explore the ins and outs of performing various key tasks such as data collection, cleaning, manipulation, aggregations, and filtering techniques. As you make your way through the chapters, you will turn raw data into actionable insights by wrangling and extracting data from databases using T-SQL. You will get to grips with preparing and presenting data in a meaningful way, using Power BI to reveal hidden patterns. In the concluding chapters, you will work with SQL Server integration services to transform data into a useful format and delve into advanced examples covering machine learning concepts such as predictive analytics using real-world examples.

By the end of this book, you will be in a position to handle the growing amounts of data and perform everyday activities that a data science professional performs.

What you will learn

  • Understand what data science is and how SQL Server is used for big data processing
  • Analyze incoming data with SQL queries and visualizations
  • Create, train, and evaluate predictive models
  • Make predictions using trained models and establish regular retraining courses
  • Incorporate data source querying into SQL Server
  • Enhance built-in T-SQL capabilities using SQLCLR
  • Visualize data with Reporting Services, Power View, and Power BI
  • Transform data with R, Python, and Azure

Who this book is for

Hands-On Data Science with SQL Server 2017 is intended for data scientists, data analysts, and big data professionals who want to master their skills learning SQL and its applications. This book will be helpful even for beginners who want to build their career as data science professionals using the power of SQL Server 2017. Basic familiarity with SQL language will aid with understanding the concepts covered in this book.

Table of Contents

  1. Data Science Overview
  2. SQL Server 2017 as a Data Science Platform
  3. Data Sources for Analytics
  4. Data Transforming and Cleaning with T-SQL
  5. Data Exploration and Statistics with T-SQL
  6. Custom Aggregations on SQL Server
  7. Data Visualization
  8. Data Transformations with Other Tools
  9. Predictive Model Training and Evaluation
  10. Making Predictions
  11. Getting It All Together – A Real-World Example
  12. Next Steps with Data Science and SQL

Introducing Microsoft SQL Server 2016: Mission-Critical Applications, Deeper Insights, Hyperscale Cloud

Posted on Updated on

by Stacia Varga (Author), Denny Cherry (Author), Joseph D’Antoni

With Microsoft SQL Server 2016, a variety of new features and enhancements to the data platform deliver breakthrough performance, advanced security, and richer, integrated reporting and analytics capabilities. In this ebook, we introduce new security features: Always Encrypted, Row-Level Security, and dynamic data masking; discuss enhancements that enable you to better manage performance and storage: TemDB configuration, query store, and Stretch Database; review several improvements to Reporting Services; and also describe AlwaysOn Availability Groups, tabular enhancements, and R integration.