|
|
-
|
|
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......
|
|
-
|
|
I had blogged about Different ways to know structure of the tables. One of the methods is to highlight the object name and press Alt+F1. But this will not work if the object name contains multiparts ie database name, owner name etc.
Consider the following object
sys.objects
Applying Alt+F1 wil......
|
|
-
|
|
There are many aggregate functions available in SQL Server. One thing that most of the people forget is that Aggregate functions always return atleast a row no matter if there are rows in the table or where clause returns or does not return any resultset
Consider the following example
declare @t......
|
|
-
|
|
A computed column in SQL Server is an expression which is based on another column in the same table. Consider the following example
create table test_table
(
id int,
names varchar(100),
cust_id as right('00000'+cast(id as varchar(10)),5)
)
GO
insert into test_table (id, names)
sel......
|
|
-
|
|
As you know, Pinal Dave, SQL Server MVP, Blogger,Speaker and Evangelist is the co-author of the part 4 of the series SQL Programming Joes 2 Pros: Programming & Development For Microsoft SQL Server 2008 (SQL Exam Prep Series 70-433 (Volume IV)
He is now,along with Vinod kumar, author of anothe......
|
|
-
|
|
Run this code
select $k
You will get following error
Msg 126, Level 15, State 1, Line 1
Invalid pseudocolumn "$k".
What is the pseudocolumn in SQL Server?......
|
|
-
|
|
As I have informed you earlier in this post, there are some interesting tips I have contributed in October 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 statemen......
|
|
-
|
|
We can use SPACE function to replicate spaces for a string. Consider the following statement
select 'A'+space(10)+'B'
The result is
------------
A B
As you see space function adds 10 spaces between the string A and B. Note that the space function though accepts any positive numbe......
|
|