|
|
-
17 Liked
| 10 Learned
| 12 Comments
|
|
Sometimes it happens that we need random row (or set of randoms rows) from table.
Itzik Ben-Gan shows us, in one of his book, the efficient way to do this:
SELECT TOP(1) * FROM someTable ORDER BY NEWID()
Changing the value in TOP operator, we can, in...
|
|
-
17 Liked
| 15 Learned
| 7 Comments
|
|
1) Transaction log are not recorded for table variables so they are transactional neutral or you can say that they are out of scope of transaction mechanism. Whereas temp tables participate in transactions just like normal tables
2) Table variables c......
|
|
-
17 Liked
| 14 Learned
| 2 Comments
|
|
While dropping a table present in a different database, you can use the fully qualified Table Name ("DatabaseName.SchemaName.TableName" format) and drop the table as shown below.
[code]
DROP TABLE AdventureWorks.HumanResources.Department
GO
[/code......
|
|
-
17 Liked
| 11 Learned
| 6 Comments
|
|
We can insert all the default values in tables without specifiying values while insert in table, how? See here we have tables defined all columns with default,
[code]
CREATE TABLE defaultval(
id int default 0,
name varchar(10)
de......
|
|
-
16 Liked
| 12 Learned
| 11 Comments
|
|
Hi,
We know the hint , how to get all the column names of a table into query window using drag and drop of Columns Folder under TableName.
![SSMS Hint][1]
Today , i learned another method to do the same,
**Select the query** and **right click** on...
|
|
-
16 Liked
| 11 Learned
| 2 Comments
|
|
I just was making some performance tests with some batches going one by one, that was returning only times of durations.
At start of every batch I called statements for cold start, so - in result - it added doubled
DBCC execution completed. If DBCC p...
|
|
-
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......
|
|
-
|
|
I have worked with SQL Server bit columns for years, yet even so, to my surprise I just learned that you can not only use 1 and 0, you can also use the literals 'true' and 'false'. Note that they are not explicitly bit data types already, but like 1 and......
|
|
-
16 Liked
| 14 Learned
| 1 Comments
|
|
Recently a colleague of mine asked me to give him a code for replacing spaces,dots(.),hyphens(-),braces '(' and ')'.
Here is my solution
[Code]string str= "This is a string having - and - - - - It also has dot (.) Many dots(.....)"; [/Code]
A......
|
|
-
16 Liked
| 17 Learned
| 8 Comments
|
|
Often in forums, we will see this question, "How to calculate running total?". There are various complex methods available for this and this is one of often discussed topic. Now In SQL Server 2012, OVER clause has been enhanced to calculate running tota......
|
|