Saturday, October 15, 2011
Sunday, January 31, 2010
Top Keyword
How to get top 2 record without using top keyword
set rowcount 2
select * from tblEmployeeMaster
set rowcount 2
select * from tblEmployeeMaster
Sunday, March 22, 2009
Max,Min,Second max number
(i) select max(id) from emp
we can get the max id value from this query .
(ii) select min(id) from emp
we can get min id value fom the table emp.
(iii)select max(id) from emp where id<(select max(id) from emp)
this query is combinination of two sql query.
we can get the max id value from this query .
(ii) select min(id) from emp
we can get min id value fom the table emp.
(iii)select max(id) from emp where id<(select max(id) from emp)
this query is combinination of two sql query.
DateTime format in SQL Server Query
select convert(varchar, getdate(), 1)
Output:- 12/30/06
select convert(varchar, getdate(), 2)
Output:- 06.12.30
select convert(varchar, getdate(), 3)
Output:- 30/12/06
select convert(varchar, getdate(), 4)
Output:-30.12.06
select convert(varchar, getdate(), 5)
Output:-30-12-06
select convert(varchar, getdate(), 6)
Output:-30 Dec 06
select convert(varchar, getdate(), 7)
Output:-Dec 30, 06
select convert(varchar, getdate(), 10)
Output:-12-30-06
select convert(varchar, getdate(), 11)
Output:-06/12/30
select convert(varchar, getdate(), 101)
Output:-12/30/2006
select convert(varchar, getdate(), 102)
Output:-2006.12.30
select convert(varchar, getdate(), 103)
Output:-30/12/2006
select convert(varchar, getdate(), 104)
Output:-30.12.2006
select convert(varchar, getdate(), 105)
Output:-30-12-2006
select convert(varchar, getdate(), 106)
Output:-30 Dec 2006
select convert(varchar, getdate(), 107)
Output:-Dec 30, 2006
select convert(varchar, getdate(), 110)
Output:-12-30-2006
select convert(varchar, getdate(), 111)
Output:-2006/12/30
select convert(varchar, getdate(), 8)
Output:-00:38:54
select convert(varchar, getdate(), 9)
Output:- Dec 30 2006 12:38:54:840AM
select convert(varchar, getdate(), 14)
Output:- 00:38:54:840
Output:- 12/30/06
select convert(varchar, getdate(), 2)
Output:- 06.12.30
select convert(varchar, getdate(), 3)
Output:- 30/12/06
select convert(varchar, getdate(), 4)
Output:-30.12.06
select convert(varchar, getdate(), 5)
Output:-30-12-06
select convert(varchar, getdate(), 6)
Output:-30 Dec 06
select convert(varchar, getdate(), 7)
Output:-Dec 30, 06
select convert(varchar, getdate(), 10)
Output:-12-30-06
select convert(varchar, getdate(), 11)
Output:-06/12/30
select convert(varchar, getdate(), 101)
Output:-12/30/2006
select convert(varchar, getdate(), 102)
Output:-2006.12.30
select convert(varchar, getdate(), 103)
Output:-30/12/2006
select convert(varchar, getdate(), 104)
Output:-30.12.2006
select convert(varchar, getdate(), 105)
Output:-30-12-2006
select convert(varchar, getdate(), 106)
Output:-30 Dec 2006
select convert(varchar, getdate(), 107)
Output:-Dec 30, 2006
select convert(varchar, getdate(), 110)
Output:-12-30-2006
select convert(varchar, getdate(), 111)
Output:-2006/12/30
select convert(varchar, getdate(), 8)
Output:-00:38:54
select convert(varchar, getdate(), 9)
Output:- Dec 30 2006 12:38:54:840AM
select convert(varchar, getdate(), 14)
Output:- 00:38:54:840
Subscribe to:
Comments (Atom)