|
|
-
|
|
“Denali” introduces Ad-hoc query paging in which you can specify range of rows returned by a SELECT statement. This can be handy when you want to limit number of returned by the statement.
This is implemented in ORDER BY clause. two new keywords are added to ORDER BY clause:
1. OFFSET:......
|
|
-
|
|
If you want to attach a database to a SQL Instance you need both the data file (.mdf) and the log file (.ldf). Without both files you cannot attach a database. Let’s try doing that…
To attach a database from Management Studio:
Right click on Database node and choose attach:
This ......
|
|
-
|
|
Earlier, I posted about how to connect to a SQL Instance automatically when you launch Management Studio using command-line options.
Management Studio Startup Parameters – Tips & Tricks
This seems to work fine with Management Studio 2005 / 2008.
However, The new version “Denali&rd......
|
|
-
|
|
This is probably one of the most frequently asked question – How to concatenate rows? And, the answer is to use XML PATH.
For example, if you have the following data:
– © 2011 – Vishal (http://SqlAndMe.com)
USE AdventureWorks2008R2
SELECT CAT.Name AS [Category],
......
|
|
-
|
|
We can populate a table using a dump of data available as a text file. You can also import data from various type of files including CSV and raw file into SQL. In the example we’ll look at how to import data from a Text file into SQL Table.
For this example, I have a Text file ProductList.txt......
|
|
-
|
|
Recently, I encountered this message in one of our production servers. When I checked the SQL Agent Log I found below error message.
I searched for a solution and found a KB article which describes the issue, KB928317.
The KB article describes only one scenario that a Full backup must exist be......
|
|
-
|
|
If you are managing a lot of databases, you might need to scratch your head for a while to remember where and when did you backed up a database. Fortunately, this information is stored in MSDB database and can be easily retrieved using below tables:
1. backupmediafamily – contains one row for......
|
|
-
|
|
You can create shortcuts for frequently used queries in Management Studio, some of the shortcuts are predefined, like pressing “Ctrl + 1” will execute “sp_who2”. You can create shortcuts for your own queries or change the existing shortcuts. To create a new shortcut go to Too......
|
|
-
|
|
We use the undocumented stored procedure sp_who2 to check for blocked process on the server. The output returned by this stored procedure returns all processes on the server.
now, to find the processes which are actually blocked, you need to go through the result set, which will be almost > 50 ......
|
|
-
|
|
Often we need to transpose the result set converting rows to columns. let’s look at an example. you can find the syntax on BOL. consider the following data:
We need to convert this to a pivot table, the out put should transpose the WeekIDs to rows from columns, the expected result is:
......
|
|