SQL Server

This category contains 9 posts

SQL Server tip : Query a range of characters ?

If you need to query all People from Person table with FirstName start with A, you can easily query like below, What if you want to list all the people from person table with first name start with A and B? You can combined Like operator with OR and query like below, But imagine scenario … Continue reading »

SQL Server Tip : . Where to use SQURE Bracket around table name?

Have you ever thought, what if your table name 1. Is exactly as of SQL Server keyword 2. Is having space in between like Student Fav Actor If you go ahead and query against table Student Fav Actor like below, most likely you will get error message as below, There may me one more scenario … Continue reading »

Output clause in SQL Server

Level: Beginners [level 100] Output   clause gives access to Inserted, updated or deleted rows of table. In SQL Server 2005 this was possible only through Triggers. Note: In all explanation, I am going to use School Database. You can download script from here Imagine a scenario that while inserting a value in Person table, … Continue reading »

SQL Server: WAITFOR Statement

WAITFOR statement used to delay execution of T-SQL command for a specified period of time. This can be used to block the execution of batch statement, stored procedure and T SQL commands for a specified time. There are two parameters can be used with WAITFOR statement. Let us create simple stored procedure Let us execute … Continue reading »

String Concatenation and Scope Resolution Operator in SQL Server 2008 R2

Target Audience: Beginners SQL Server 2008 R2 comes with String Concatenation Operator. String Concatenation operator is denoted by symbol plus ‘+’. Output we will get, String concatenation operator can concatenate string with real time data of any type also. In above query , firstName and lastName column is being concatenated using string concatenation operator of … Continue reading »

Microsoft Sql Server, Error : 10061

I tried to connect SQLTEST instance of SQL Server and got below error This is very common error and can be caused due to many reasons. The way I solved it 1. Go to Start 2. Type Run 3. Type Services.msc 4. Then locate for SQL Server instance you are trying to connect. In my … Continue reading »

Tracking Change Data Capture in SQL Server 2008

A very important feature of SQL Server 2008 is that we can enable CDC [Change Data capture] on database or table. We can track the database had CDC enabled by querying IS_CDC_ENABLED column In above query School is name of the database. If we want to track tables in database whether CDC enabled or not … Continue reading »

Data Compression in SQL Server 2008

SQL Server 2008 automatically compress data stored in database. SQL server does Lossless data compression. SQL server uses Dictionary based compression algorithm. Row Level Data Compression For Row level Data Compression SQL Server does not use explicitly any standard compression algorithm. It works on very simple algorithm. Say, 1. You created a column of CHAR(50) … Continue reading »

Create a SQL Login user in SQL Server 2008

This article will give a walkthrough on creating a SQL Login user. Step 1 Login to SQL Server 2008 instance using windows authentication Step 2 Right click on server instance name and select properties. Step 3 Property window will be open. In that select the Security tab. In server authentication tab you can see your … Continue reading »

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,380 other followers

Tweets

Categories

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my current or previous employer's view in anyway. © Copyright 2012