Programming with Talha Tanweer
Asp.net
Ado.net
C#
Sql
Entity Framework
Articles
Question & answers
Forums
How to
Monday, 31 March 2014
Find Length of string with LEN function in sql server
It returns the number of characters of string expression but with excluding trailing blanks.
SELECT
LEN
(
'Sql Server Database'
)
-- Result : 19
Thursday, 27 March 2014
Get List of all tables of a database in sql server
SELECT
*
from
sys
.
tables
Wednesday, 26 March 2014
Get List of all stored procedures of a database in sql server
SELECT
*
from
sys
.
procedures
Tuesday, 25 March 2014
Find Age from Date of Birth in Sql Server
declare
@dob
datetime
=
'1952-08-14 21:11:19.300'
select
CAST
(
DATEDIFF
(
Y
,
@dob
,
getdate
()
)/
365.25
as
int
)
-
- 365 are the Number of Average days in 4 years
Sunday, 23 March 2014
Select Top N rows from a table in Sql Server
Suppose if N=10 then ,
Select
Top
10
*
from
Person
IF you want to Select only particular columns then,
Select
Top
10
Name
,
City
,
Age
from
Person
Get current system date in Sql Server
SELECT
GETDATE
()
-- Result : 2014-03-23 19:57:21.630
Wednesday, 12 March 2014
Find Version of Sql Server through query
select
@@Version
Result from My Computer:
--Microsoft SQL Server 2012 - 11.0.2100.60 (X64)
--Feb 10 2012 19:39:15
--Copyright (c) Microsoft Corporation
-
-Enterprise Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: )
Friday, 7 March 2014
Reverse values with Reverse function in Sql Server
select
REVERSE
(
45
)
-- Result 54
select
REVERSE
(
'abc'
)
--
Result cba
Thursday, 6 March 2014
Select Last Date of Current year in Sql Server
SELECT
DATEADD
(
yy
,
DATEDIFF
(
yy
,
0
,
getdate
())
+
1
,
-
1
)
AS
LastDateOfYear
Select First Date of Current year in Sql Server
SELECT
DATEADD
(
yy
,
DATEDIFF
(
yy
,
0
,
getdate
() ),
0
)
AS
FirstDateOfYear
Wednesday, 5 March 2014
#region in Visual Studio
It allows block of code to expand or collapse when using the outlining feature of the Visual Studio Code Editor. You can write namespaces, classes, methods, interfaces, delegates, events inside it.
#region
MyRegion
// Namespaces
// Classes
// Methods
// Interfaces
// Delegates
// Events
#endregion
Page Pre_Render Event in Asp.net C#
If you want to perform some action after the page is completely loaded and Ready to Render then the desired code should be written in this event.
protected
void
Page_PreRender(
object
sender,
EventArgs
e)
{
// Your Code Goes Here
}
Newer Posts
Older Posts
Home
Subscribe to:
Comments (Atom)