|
|
-
22 Liked
| 9 Learned
| 12 Comments
|
|
From a disconnected query window, we can connect back to the SQL Server instance from the **Query > Connection > Connect** menu option. This may sound simple, but I found this interesting.
I usually press F5 (or execute button) twice to get connected a...
|
|
-
22 Liked
| 15 Learned
| 10 Comments
|
|
Aggregate functions always return at least one row. So using aggregate functions to check for the existance of data will not give correct results. See the results returned from these queries
[code]
declare @t table(i int)
if exists(select i from @t......
|
|
-
21 Liked
| 11 Learned
| 17 Comments
|
|
I just stumbled across a weird misconception that I'd like to help you to avoid:
If you consume the results of a (non-inline) table valued function, the results are not in the same order as if you take the content óf the TVF in your query.
So, if you h...
|
|
-
21 Liked
| 16 Learned
| 8 Comments
|
|
While trying to retrieve the select top count dynamically, initially tried this way
[code]
Declare @noOfRowsPerChunk int
set @noOfRowsPerChunk = 5
select top @noOfRowsPerChunk RecordID from myTable
[/code]
which throwed the syntax error.
Fix:......
|
|
-
|
|
I learned about this from Pinal Dave's blog(You can see the original article in references.)
In SQL Server, while creating a table, we can give maximum length of 128 characters. However, while creating temp tables, maximum length can be of 116 characte...
|
|
-
20 Liked
| 11 Learned
| 10 Comments
|
|
I have always heard about the terms sargable and non-sargable but never really understood how they help in developing efficient sql code. Here is what I have found out...
Try to avoid WHERE clauses that are non-sargable. The term “sargable” (which is i...
|
|
-
20 Liked
| 25 Learned
| 13 Comments
|
|
Recently read an article, which explains the surprising trick to reveal the folder which has all system management shortcuts.
1. Create a new folder in any of drives.
2. Rename the folder with the text "GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}......
|
|
-
20 Liked
| 18 Learned
| 7 Comments
|
|
DBA should keep a list of tables which are not being used / referenced by anyone in last few weeks. At times, we come up with a requirement where developer asks, can I have list of unused tables or “Can you tell me the tables which are not being used i......
|
|
-
19 Liked
| 21 Learned
| 8 Comments
|
|
Assume that there are two tables table1 and table2 which have same structures and table1 has 10 millions rows and you want to move all rows from table1 to table2. The quickest method that I have learnt is to use Partition Switching
[code]
alter table......
|
|
-
19 Liked
| 17 Learned
| 8 Comments
|
|
The WRITETEXT statement is used to update a column of datatypes text, ntext and image. However it will not fire INSERT or UPDATE triggers......
|
|