|
|
-
16 Liked
| 17 Learned
| 10 Comments
|
|
One of the problems I always faced when storing multi-line text into a SQL Server table is the trouble in retrieving it and analysing it in SSMS. If I take output to Grid, I will lose the line breaks and formatting. If I take output to text, it is trunc......
|
|
-
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...
|
|
-
14 Liked
| 14 Learned
| 10 Comments
|
|
Just learned from focus.com's Editors article.In that they have identified Top 10 Largest Databases in the World, Here we have the list.
I)The Library of Congress (LC) boasts more than 130 million items ranging from cook books to colonial newspapers ......
|
|
-
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......
|
|
-
18 Liked
| 12 Learned
| 10 Comments
|
|
There are no non-logged user database operations. The only non-logged operations are the version stores in tempdb
TRUNCATE TABLE is minimally-logged:
1) Metadata changes are always logged at TRUNCATE time
2) Extent/page deallocations may be logged......
|
|
-
11 Liked
| 6 Learned
| 10 Comments
|
|
Replicate() function can be used to replicate characters. suppose replicate('a',5) will returns "aaaaa"
When you are using replicate function, if it returns more than 8000 characters, it will truncate that.
To prevent that, you need to cast to nvarc......
|
|
-
|
|
Recently I came across a code written by a developer. He was trying to solve a problem to find max and min value among multiple column for each row. Through Below dummy code I am trying to explain -
--Use tempdb
USE tempdb
--Create a d...
|
|
-
|
|
Copy And paste Query
Create table #temp1
(
id int ,
Name varchar(50),
City varchar(50)
)
Create table #Staging_temp2
(
id int,
Name varchar(50),
City varchar(50)
)
insert into #temp1
se...
|
|
-
13 Liked
| 10 Learned
| 9 Comments
|
|
Sometimes when SQL Server is configured to use some port other than default port number (1433), then you may not be able to connect directly in SSMS just by specifying the name of the server in the **Server Name** field in **Connection to Server** dialo...
|
|
-
|
|
While the following works without any error
[code]select $*$
select $/$ -- valid and throw divide by zero error
[/code], the following will not work
[code]select $+$
select $-$ [/code]
The correct usage is to wrap by braces
[code]select ($)+($)
......
|
|