DotNet Mirror
  DNM facebook   DNM Google+   DNM Twitter   
Stats
Total Count : 20
Resources Publish New Article  
 
mssql-scripter : generate SQL Server DML and DDL Scripts on Linux, macOS and Windows
Ashok Nalam
By: Ashok Nalam | 04 Jan 2018 | SQL Server | Views: 5075 | Comments: 0 | Tags:GitHub  open source  SQL Server 
SQL Operations Studio (sqlopsstuidio) is ready to download and install
Ashok Nalam
By: Ashok Nalam | 20 Dec 2017 | SQL Server | Views: 4903 | Comments: 2 | Tags:GitHub  open source  SQL Server 
mssql-cli, Command-line client for SQL Server with auto-completion and syntax highlighting
Ashok Nalam
By: Ashok Nalam | 14 Dec 2017 | SQL Server | Views: 5382 | Comments: 2 | Tags:open source  SQL Server  tool 
SQL Server 2017 Community Technology Preview 2.0 is available
Ashok Nalam
By: Ashok Nalam | 20 Apr 2017 | SQL Server | Views: 5749 | Comments: 2 | Tags:SQL Server  SQL Server 2017 
Microsoft SQL Server 2016 Service Pack 1 is released
Ashok Nalam
By: Ashok Nalam | 20 Nov 2016 | SQL Server | Views: 5825 | Comments: 0 | Tags:service pack  SQL Server 2016 
Set Default Database with SQL Server Management Studio
Ashok Nalam
By: Ashok Nalam | 27 Mar 2014 | SQL Server | Views: 8670 | Comments: 2 | Tags:database  SQL Server  tsql  user 
SQL Server: Find database mdf and ldf physical file locations using T-SQL
Ashok Nalam
By: Ashok Nalam | 14 Feb 2014 | SQL Server | Views: 9031 | Comments: 2 | Tags:database  file  tsql 
CONCAT() string function in SQL Server 2012
Ashok Nalam
Article shows how to use CONCAT() function which is introduced with SQL Server 2012 version and also covers different features of it.
By: Ashok Nalam | 10 Feb 2014 | SQL Server | Views: 5403 | Comments: 0 | Tags:SQL Server 2012  string  tsql 
Cannot connect to SQL Server. Login failed for user 'sa'. (Microsoft SQL Server, Error: 18456)
Ashok Nalam
By: Ashok Nalam | 17 Jan 2014 | SQL Server | Views: 6926 | Comments: 0 | Tags:error 
SET IDENTITY_INSERT for Table Variable
Ashok Nalam
By: Ashok Nalam | 09 Jan 2014 | SQL Server | Views: 14034 | Comments: 2 | Tags:identity  table  variable 
The file "AdventureWorksDW2012_Data.mdf" is compressed but does not reside in a read-only database or filegroup. The file must be decompressed.
Ashok Nalam
By: Ashok Nalam | 25 Nov 2013 | SQL Server | Views: 9763 | Comments: 0 | Tags:database  error  SQL Server 
install AdventureWorksDW Database on SQL Server2012
Ashok Nalam
By: Ashok Nalam | 25 Nov 2013 | SQL Server | Views: 15991 | Comments: 0 | Tags:database  SQL Server 2012 
EOMONTH() function in SQL Server 2012
Ashok Nalam
EOMONTH is new built-in Date and Time function which is introduced with SQL Server 2012.We will see EOMONTH usage with examples and EOMONTH() Equivalent in SQL Server 2008 R2 and below.
By: Ashok Nalam | 24 Sep 2013 | SQL Server | Views: 11154 | Comments: 0 | Tags:SQL Server 2012 
Rollback transaction behavior on table variable
Ashok Nalam
By: Ashok Nalam | 24 Jul 2013 | SQL Server | Views: 25570 | Comments: 0 | Tags:table  transactions  tsql 
Insert data to table with only one IDENTITY column exists in table
Ashok Nalam
If we have a table with only one column which is marked as IDENTITY column, then how we will insert data to table? This scenario will be very rare. But we will see how to insert data to table with only one IDENTITY column exists.
By: Ashok Nalam | 24 May 2013 | SQL Server | Views: 7444 | Comments: 0 | Tags:identity  insert  table 
Bulk import in SQL Server 2008 from CSV file
Maram Kiran Kumar
By: Maram Kiran Kumar | 15 Apr 2013 | SQL Server | Views: 5497 | Comments: 0 | Tags:Bulk import  CSV file  SQL Server 
Difference between count(*) and count(column_name)
Ashok Nalam
We might assume that count(*) and count(column_name) will return same result count. But NO, in case of column holds any null values.

Count (*) – returns all values (including nulls and duplicates)
Count (Column_Name) – returns all Non-NULL values(including duplicates)

In the below script we will see how it works. So that it will be easy for us to understand.
create table #tempTable(Name char(1))
insert into #tempTable values("A")
insert into #tempTable values("B")
insert into #tempTable values(Null)
insert into #tempTable values("C")
insert into #tempTable values(Null)
insert into #tempTable values("C")
select COUNT(*) from #tempTable
select COUNT(Name) from #tempTable
drop table #tempTable
Output: 6 and 4
The table #temptable has total 6 rows. Count(*) returns all the rows including null/duplicates but where as count(name) returns only 4 rows which includes duplicates("C") but not null values.

If you want to remove the duplicates from count(Name) then use distinct keyword in it.
select COUNT(distinct Name) from #tempTable –-returns 3
By: Ashok Nalam | 28 Dec 2012 | SQL Server | Views: 10053 | Comments: 0 | Tags:difference  tsql 
Looping through rows without cursors in Sql server using while loop
Ashok Nalam
In this snippet we will see how to iterating through the table rows data with out using cursor in SQL server.
By: Ashok Nalam | 22 Dec 2012 | SQL Server | Views: 21335 | Comments: 0 | Tags:cursor  tsql 
GET/Remove the last character from a string in SQL Server
Ashok Nalam
We will see how to get and remove last character from a string in sql server.
By: Ashok Nalam | 14 Dec 2012 | SQL Server | Views: 20481 | Comments: 0 | Tags:string  tsql 
Does UNIQUE KEY supports more than one NULL Value?
Ashok Nalam

No. In SQL server we can insert only one NULL value to column which has UNIQUE KEY constraint.

Example:

CREATE TABLE SamepleUnique
(
Id INT PRIMARY KEY,
Name varchar(20) UNIQUE
)
INSERT INTO SamepleUnique VALUES(1,'Ram')
INSERT INTO SamepleUnique VALUES(2,'Krish')
INSERT INTO SamepleUnique VALUES(3,Null)
INSERT INTO SamepleUnique VALUES(4,Null) --Error as Violation of UNIQUE KEY constraint 'UQ__SamepleU__737584F603317E3D'. Cannot insert duplicate key in object 'dbo.SamepleUnique'.
--The statement has been terminated.


By: Ashok Nalam | 12 Dec 2012 | SQL Server | Views: 5686 | Comments: 1 | Tags:Constraints  unique key