Posts

Showing posts from 2014
Image
             Difference between INNER and OUTER joins In a database such as MSSQL, data is divided into a number of tables which are then connected (Joined) together by JOIN in SELECT commands to read records from multiple tables. Assuming you're joining on columns with no duplicates, which is a very common case: An inner join of A and B gives the result of A intersect B, i.e. the inner part of a venn diagram intersection. An outer join of A and B gives the results of A union B, i.e. the outer parts of a venn diagram union. Examples Suppose you have two Tables, with a single column each, and data as follows: A    B -    - 1    3 2    4 3    5 4    6 Note that (1,2) are unique to A, (3,4) are common, and (5,6) are unique to B. Inner join An inner join using either of the equivalent queries gives the intersection of the two tables, i.e. the tw...

Creating a Simple Hit Counter with ASP.NET 4.0 and C#

This tutorial will demonstrate how to create a simple system to count hits on  pages using a database with ASP.NET 4.0 and C#. STEPS : Just follow the steps and get result easily.  STEP-1 : CREATE NEW PROJECT Go to File > New > Project > Select asp.net web Form Application> Entry Application Name > Click OK. STEP-2: ADD A DATABASE. Go to Solution Explorer > Right Click on App_Data folder > Add >New Item> Select SQL Server Database Under Data > Enter Database name > Add. GO /****** Object:  Table [dbo].[tbl_Hits]    Script Date: 06/03/2014 16:04:51 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[tbl_Hits](  [Hit_Id] [int] NULL,  [Hit_Name] [nvarchar](50) NULL,  [Hits] [nvarchar](50) NULL ) ON [PRIMARY] GO STEP-4:ADDING THE COONCETING STRING <connectionStrings>    <add name="ErpConnection" connectionString="Data Source=MANVENDRA;Initial C...

How to format datetime & date in Sql Server 2008

Execute the following Microsoft SQL Server T-SQL datetime and date formatting scripts in Management Studio Query Editor to demonstrate the multitude of temporal data formats available in SQL Server. First we start with the conversion options available for sql datetime formats with century (YYYY or CCYY format). Subtracting 100 from the Style (format) number will transform dates without century (YY). For example Style 103 is with century, Style 3 is without century. The default Style values – Style 0 or 100, 9 or 109, 13 or 113, 20 or 120, and 21 or 121 – always return the century (yyyy) format. – Microsoft SQL Server T-SQL date and datetime formats – Date time formats – mssql datetime  – MSSQL getdate returns current system date and time in standard internal format SELECT   convert ( varchar ,   getdate (),  100 )   – mon dd yyyy hh:mmAM (or PM)                  ...