|
|
-
|
|
Run the following code
declare @t table(i int unique)
insert into @t
select 1 union all
select null union all
select null
You will get the following error
Msg 2627, Level 14, State 1, Line 3
Violation of UNIQUE KEY constraint 'UQ__#A989971__3BD019979D26A3BB'. Cannot insert duplica......
|
|
-
|
|
Did you know that table variables are stored in the tempdb database for execution scope only?. Ok. Let us run this code
declare @t table(i int)
select * from tempdb.INFORMATION_SCHEMA.TABLES
The result is
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE
--------------------......
|
|
-
|
|
As you know I have started a new series on "Exploring SSMS" by which I will be posting some features that are available in SSMS which will be very helping during the development. In this post we will see how to display line number in query window.
When you write queries in Query window, the line nu......
|
|
-
|
|
As you know I have started a new series on "Exploring SSMS" by which I will be posting some features that are available in SSMS which will be very helping during the development. In this post we will see how to open query window at default when opening SSMS.
When you start SSMS, by default it opens......
|
|
-
|
|
Often peple ask this question in the forum. "I created a procedure with proper alignment. But when I wanted to alter the procedure, result of sp_helptext did not keep the original alignment. How do I keep the original format?"
Well. One answer is to make use of Script Stored Procedure --> ALTER TO ......
|
|
-
|
|
In this post Dynamic PIVOT in SQL Server 2005, I have shown a way to dynamically generate the column values with names. I used to get mails frequently from people on how to pass parameters when executing the procedure.
The following will find total sales made by each employee for each year(from Emp......
|
|
-
|
|
Without running this query, can you guess the output?
Query :
select 999'''45'
Output :
Result 1 : Incorrect syntax near '
Result 2 : 999
Result 3 : 999'45
Result 4 : invalid column name 45
......
|
|
-
|
|
As you know I have started a new series on "Exploring SSMS" by which I will be posting some features that are available in SSMS which will be very helping during the development. In this post we will see how to insert code template for creating a table, stored procedure, login etc in the SQL Server ......
|
|
-
|
|
As you know I have started a new series on "Exploring SSMS" by which I will be posting some features that are available in SSMS which will be very helping during the development. In this post we will see how to know to hide system databases from the SQL Server management studio.
In the Tool bar, g......
|
|
-
|
|
Square braces in SQL Server play a major role in T-SQL programming. When an object name contains a space, special character, etc, the only way to express them is to put them around squre braces. Consider that you want to create a table user master (with spaces between user and master), you can use [u......
|
|