|
|
-
|
|
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......
|
|
-
|
|
As you know NULL is the absence of data and any datatype can be NULL. But by default a NULL value is considered to be of INT datatype. Let us run the following code
select null as t into #t
GO
exec tempdb..sp_help #t
A NULL value is copied to a temporary table #t. Second resultset of sp_help ......
|
|
-
|
|
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 if a procedure is extended stored procedure.
In the Object Explorer, goto Database......
|
|
-
|
|
Consider the following table
create table #t(id int, names varchar(100))
insert into #t
select 1,'name1'
union all
select 2,'name2'
Consider the following select statement
select id from #t
order by id,id
It returns the error
Msg 169, Level 15, State 1, Line 3
A column has been spe......
|
|
-
|
|
You can use Ordinal position in the ORDER BY Clause for sorting the resultset. The ordinal position refers the column position in the SELECT statement. Consider the following select statement
select * from
(
select 17 as a,2 as b
union all
select 1 as a,25 as b
) t
order by 1
The above......
|
|