Tags » T-SQL

I Finally Get Cross Apply!

For years I’ve looked at various queries online in sample code, diagnostic queries using DMVs, and the like and seen CROSS APPLY in the FROM… 625 more words


Backup Comand options

— Restore from multiple backup files
DISK = ‘C:\Deployment\Hack_1.bak’,
DISK = ‘C:\Deployment\Hack_2.bak’,
DISK = ‘C:\Deployment\Hack_3.bak’
RESTORE HEADERONLY FROM DISK = ‘C:\Deployment\Hack.bak’ 288 more words


T-SQL - Dynamic SQL

You can execute a string as SQL command.

DECLARE @myQuery AS NVARCHAR(MAX) = N'SELECT * FROM HR.Employees WHERE firstname = N''Sara''';
EXECUTE(@myQuery); -- 1st example
EXEC(@myQuery); -- 2nd example
EXEC sp_executesql @myQuery; -- 3rd example
… 50 more words

How much transaction log, transactions generate?

Hi Everyone,

I wanted to share something that I am doing this week at work. One of the applications that I support is generating a lot of transaction log in the database. 406 more words


Converting Comma Separated Value to Rows and Vice Versa in SQL Serve


Posted May 21, 2015

Converting Comma Separated Value to Rows and Vice Versa in SQL Server

By Arshad Ali


Often while reporting you will encounter a situation where you will have comma separated (or separated with some other character) values in a single column but you want to report them in rows whereas in some other cases you might have values in multiple rows and want them to be a single value separated by comma or some other character. 624 more words


T-SQL FizzBuzz

I was looking around for something to write about this evening and came across one of Russ Thomas’ (b/t) old monthly challenges… 681 more words

SQLServerPedia Syndication

Reading from a data source

Last time we listed out several things that can be done with or to a data source.

Now all of the examples we’ll be using in this series will use a database as a data source. 357 more words