|
|
-
|
|
When a datatype timestamp or rowversion is used, it generates unique value whenever a row is added or updated in a table. It is one of the ways to generate auto-generated values not only for insertion but for updation too. If you want to know the minimum active rowvertion number for a database, you ......
|
|
-
|
|
Without running the following code , can you guess the datatype of the column t?
select null+getdate()+772.67 as t into #t5
......
|
|
-
|
|
The system variable @@TRANCOUNT is used to get the number of transactions that are active. Consider the following code
begin transaction
select 3
select @@TRANCOUNT
commit transaction
The result of @@TRANCOUNT is 1. Consider the following code.
begin transaction
select 3
begin transac......
|
|
-
|
|
As I have informed you earlier in this post, there are some interesting tips I have contributed in December 2011. You may find them interesting if you follow them. The following are some of my tips I posted there
Most Learned Posts of all time
You can drop multiple tables using single DROP stateme......
|
|
-
|
|
In the Query Analyser, set the Result mode to Text (Press CTRL+T) and run the following code
set nocount on
select
space(17-len(replicate(char(94),no)))+ replicate(char(94),no*2-1)
from
(
select top 10 row_number() over (order by name) as no from sysobject......
|
|
-
|
|
Often deveopers confuse themselves between Timestamp and Datetime datatypes. But they are entirely different datatypes. Although the name has Time, the Timestamp datatype has nothing to do anything with date or time. Also you cannot explicitely add/update that column. It gets updated whenever data a......
|
|
-
|
|
Assume that there is a database named test in the server and you want to take a backup of that database. Run the following code without specifying the path
backup database test to disk=''
You will get the following error messages
Msg 3044, Level 16, State 2, Line 1
Invalid zero-length device......
|
|
-
|
|
Suppose there are two tables which have 5 and 4 rows respectively and related by the column id. If you want to join these two tables and get data from table1 you can write old style join like below
create table table1 (id int, names varchar(100))
insert into table1
select 1,'test1' union all
s......
|
|
-
|
|
This is just for Fun. The following code is unformatted, unclear and may be confusing. But curious to know the result? Set the result mode of the query window to Text . While you are in Query Window press CONTROL+T and run the following code and see what it returns.
......
|
|
-
|
|
As I have informed you earlier in this post, there are some interesting tips I have contributed in November 2011. You may find them interesting if you follow them. The following are some of my tips I posted there
Most Learned Posts of all time
You can drop multiple tables using single DROP stateme......
|
|