Tags » T-SQL

Workaround for Self-Joining Table Limitations on Indexed Views

Indexed views are special views that can offer huge performance improvements over regular views. They perform faster because they are stored in the database the same way a table is stored. 378 more words


sp_SrvPermissions & sp_DBPermissions V6.0 Finally!

It’s been almost 3 years since I updated these SPs! I can’t believe so much time has gone by! Well, I’m sure all of you have been holding your collective breath but I finally have some new updates. 528 more words

SQLServerPedia Syndication

Create dynamic PIVOT queries in SQL Server.

In this Script we will look how we can dynamically create the pivot Script to handle the unknown values.

USE AdventureWorks2012;
CREATE TABLE dbo.Players
 FormatID INT,
 PlayerID INT ,
 Formats Varchar(50),
 Average Int
(1,1, N'MS Dhoni','ODI',55),
(1,2, N'Rohit Sharma','ODI',40),
(1,3, N'Virat kholi','ODI',60),
(1,4, N'ABD','ODI',60),
(2,1, N'MS Dhoni','TEST',45),
(2,2, N'Rohit Sharma','TEST',35),
(2,3, N'Virat kholi','TEST',56),
(2,4, N'ABD','TEST',65),
(3,1, N'MS Dhoni','T-20',57),
(3,2, N'Rohit Sharma','T-20',50),
(3,3, N'Virat kholi','T-20',56),
(3,4, N'ABD','T-20',68)

SELECT * FROM dbo.Players
Result we look like this 

But we want result something like this: 234 more words

Creating a list of random numbers

I was working on a blog post this weekend that required a list of random numbers. Now, this isn’t exactly an uncommon task, but it’s not as easy as it would seem. 482 more words

SQLServerPedia Syndication

How and why: Normalize your Data

When we talk about normalizing data within a database we really just mean that we’re organizing our data properly in order to make our database run more efficiently and reduce needless duplication. 530 more words


Restore Database using T-SQL

You can also restore your SQL Server database using T-SQL instead of SSMS.  Today I will show you how to do an easy recovery with restoring just a full backup and another scenario of restoring a full backup and any available transaction logs. 664 more words

Hints And Tips

Is it possible to use RevoScaleR package in Power BI?

I was invited to deliver a session for Belgium User Group on SQL Server and R integration. After the session – which we did online using web based Citrix  – I got an interesting question: “ 1,004 more words