Here is an easy way to get (extract) all of the characters before a special character in a string. In our example we have a listing of email addresses and we want to get the name before the @domain.
Analytic Function — Lag
Starting with SQL Server 2012, Microsoft has included analytic functions within the database. A couple that I use often, Lag and Lead, are very handy when you need to reference a previous or next row in a table without having to use self-joins or having to create a complicated sql statement.
Count Rows per Hour
Here is a useful technique to know. We have a delivery service and we want to know what hour of the day is most popular for completed deliveries. Using the DATEPART function, this can be easily calculated.
How to find information about your instance using SERVERPROPERTY.
Here is a way to find out information about your SQL Server instance using TSQL. You can query all kinds of properties, for example, what edition are you running, what server is it on, etc.
Continue reading How to find information about your instance using SERVERPROPERTY.
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.
SSIS Create extract file with Date and Time for a filename
In last weeks posting, we created our first SSIS package which queried a database and saved the information to a file so we could send the information to a user. This week we are going to modify that same package to save the file with the date and time included in the filename.
Continue reading SSIS Create extract file with Date and Time for a filename
Creating Your First SSIS Project
What is SSIS? It stands for SQL Server Integration Services which may be used for building high performance data integration and workflow solutions, including extraction, transformation, and loading (ETL) operations for data warehousing. Today I am going to show you a simple solution on how to extract data and save it to a file. This exercise will show some commonly used elements to creating a lot of different solutions.
Move User Database file to another drive
Have you ever received an email like below and then got a big pain in your stomach? Disk E: is running out of room and you need to move one of your user database files before you totally fill the disk. Yes, your VM admin might be able to add disk space but they are out sick or this is a physical machine and you need to order bigger disks and you need to make this change right now.
Capitalize a string
When you look at your data, do you see a mish mash of formats? Do some people use camel case, some all lowercase, some upper? Here is a quick script that you can use to capitalize the first letter in your single word strings.