Jul 21, 2013

What is the Maximum Relational Database Size Supported by Single Instance?

What is the Maximum Relational Database Size Supported by Single Instance?

 

 

The SQL Server 2008R2, 2012 and 2014 has maximum capacity of 524 PB (Pet byte) in the Enterprise, BI and Standard edition.

     SQL Server Express has a limitation of 10 GB due to its nature.
     It is all depending on the size of your storage system.
 

 

 

Jul 18, 2013

ClientID Mode in asp.net



ClientID Mode:

Client ID mode property can be used ID generate using Master page. While master page using content place holder used a controls the generate id is different so some confusing .The can used ClientID mode.

We can set ClientIDmode three ways the below following:

1. Application Level
2. PageLevel
3. Control Level


Application Level

We can use web.config file to set <System.Web> inside.

Example

 <pages clientIDMode="Predictable"></pages>
 

PageLevel:


<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WINDOWS8._Default"  ClientIDMode="AutoID"%>
 
 
Control Level

<asp:Button ID="btn_Add" runat="server” Text="ClickME" ClientIDMode="AutoID" />



ClientIDMode=" Static/AutoID/Inherit/Predictable/  
 
Static:
 
<asp: Button ID="btn_Add" runat="server Text="ClickMe" ClientIDMode="Static
 "/>
 
OUTPUT:
 
<input type="submit" name="ctl00$MainContent$btn_Add" value="ClickME" id="btn_Add" />
 
AutoID:
 
<asp:Button ID="btn_Add" runat="server” Text="ClickME" ClientIDMode="AutoID"/>
 
 
OUTPUT:
 
<input type="submit" name="ctl00$MainContent$btn_Add" value="ClickME" id="ctl00_MainContent_btn_Add" />
 
Inherit:
 
<asp:Button ID="btn_Add" runat="server"  Text="ClickME" ClientIDMode="Inherit"/>
 
 
Output:
 
<input type="submit" name="ctl00$MainContent$btn_Add" value="ClickME" id="MainContent_btn_Add" />
 
 
 
Predictable:

Predictable is the important mode of the Client ID Mode and it is mainly used for controls that are in data-bound controls.We can generate the ClientID value by concatenating the ClientID value of the parent naming container with the ID value of the current control.ClientIDRowSuffix is a property of the control which can be added at the end of a databound control that generates the multiple rows.Best example is the GridView Control where multiple data fileds can be specified and if the ClientIDRowSuffix property is blank then it will automatically add a sequential number at the end of the databound control id.This number begins at zero and is incremented by 1 for each row and each segment is separated by an underscore character (_).

Given below examples demonstrate how the databound control id renders in both the case(without ClientIDRowSuffix and with ClientIDRowSuffix )

<asp:GridView ID="Maxmun" runat="server" AutoGenerateColumns="false" ClientIDMode="Predictable" >
    <Columns>
        <asp:TemplateField HeaderText="ID">
            <ItemTemplate>
         <asp:Label ID="lblID" runat="server" Text='<%# Eval("ID") %>' />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Name">
            <ItemTemplate>
      <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>' />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Company Name">
            <ItemTemplate>
                <asp:Label ID="lblOrganisation" runat="server" Text='<%# Eval("CompName") %>' />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

Note:  ClientIDRowSuffix is blank by default in the above gridview declaration and just follow the given below syntax for adding the ClientIDRowSuffix in the gridview declaration

<asp:GridView ID="Maxmun" runat="server" AutoGenerateColumns="false" ClientIDMode="Predictable" ClientIDRowSuffix="ID" >
   

Output without ClientIDRowSuffix
 
<table id="Maxmun" style="border-collapse: collapse" cellspacing="0" rules="all" border="1">
    <tbody>
        <tr>
            <th scope="col">ID</th>
            <th scope="col">Name</th>
            <th scope="col">Company Name</th>
        </tr>
        <tr>
            <td><span id="Maxmun_lblID_0">001</span></td>
            <td><span id="Maxmun_lblName_0">Srikanta</span></td>
            <td><span id="Maxmun_lblOrganisation_0">Coimbatore</span></td>
        </tr>
        <tr>
            <td><span id="Maxmun_lblID_1">007</span></td>
            <td><span id="Maxmun_lblName_1">Kaushik</span></td>
             <td><span id="Maxmun_lblOrganisation_1">Coimbatore</span></td>
        </tr>
        .........
        .........
    </tbody>
</table>

Output with ClientIDRowSuffix
 

<table id="Maxmun" style="border-collapse: collapse" cellspacing="0" rules="all" border="1">
    <tbody>
        <tr>
            <th scope="col">ID</th>
            <th scope="col">Name</th>
            <th scope="col">Company Name</th>
        </tr>
        <tr>
            <td><span id="Maxmun_lblID_001">001</span></td>
            <td><span id="Maxmun_lblName_001">Srikanta</span></td>
            <td><span id="Maxmun_lblOrganisation_001">Coimbatore</span></td>
        </tr>
        <tr>
            <td><span id="Maxmun_lblID_007">007</span></td>
            <td><span id="Maxmun_lblName_007">Kaushik</span></td>
             <td><span id="Maxmun_lblOrganisation_007">Coimbatore</span></td>
        </tr>
        ......
    </tbody>
</table>









Squence Query in SQL SERVER



Select Squence Query in SQL SERVER :


-It can be used Automatic Generation number without column in the table can use Sequence concept.

 

select      (
      ROW_NUMBER()
      over (Order by EmpId))as Rownumber,
      EmpId,
      EmpName,
      EmpSalary  

      from Sequence_Tbl

Quotename() function in SQL Server

 

Quotename() function in SQL Server :

It can be used strongly string in sqlserver, the string valid return values.

Examples

select quotename('munish')   --[munish]
 
select quotename('munish [ars]') -- [munish [ars]]]
 
select quotename('munish ars', '"') -- "munish ars"
 
select quotename('munish ars''s Name', '''') -- 'munish ars''s Name'
 
select quotename('munish ars', '''') -- 'munish ars'
 
select quotename('Pravin More', '|') – NULL

Jul 14, 2013

Authorization set some page or folder in web.config in Asp.net

 

Authorization set some page or folder in web.config in Asp.net

The authentication set  to some page only allowed public page and other page only private page .How can developing these are things, Its very easy to change Web.config file let us see…


 <authentication mode="Windows/Forms ">

 <authorization>
         <deny users="*"/>
  </authorization>
 
Now I wrote the Web.config file all page restrict the browser the project the Below Error.
 

Access is denied.

Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.
 
IF you have changed the some page only allowed public Access to use to below source code.
 
Page Level
 
<location path="TestAuth.Aspx">
    <system.web>
      <authorization >
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
 
Folder Level:
  
If you have using Folder Authentication Account used the below code.
 
<location path="Account">
    <system.web>
      <authorization >
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
 
The Authorization using
   -> User 
   -> Roles 
 
 <allow users="*"/> -The Allow to user view the page everyone,
 <allow Roles="*"/> -The Allow to Roles view the page everyone,
  
  <allow Roles="Admin, Customer"/> -The Allow to Roles view the page Admin an d customer,
 
 
Deny Anonymous user to access entire website
This is the case when you want everybody to login before the can start browsing around your website. i.e. The first thing they will see is a login page.
  <system.web>
    <authentication mode="Forms">
    </authentication>
    <authorization>
      <deny users="?"/> //will deny anonymous users
    </authorization>
  </system.web>
Images and CSS files
Say you have all your images and CSS in a seperate folder called images and you are denying anonymous access to your website. In that case you might see that on your login page you cannot see images(if any) and css(if any) applied to your login page controls.
In that case you can add a web.config to the images and css folder and allow access to everyone to that folder. So your web.config in images folder should look as below:
<configuration>
    <system.web>
      <authorization>
        <allow users="*"/> //Allow everyone
      </authorization>
    </system.web>
  </configuration>

Common Mistakes
I have seen people complaining that they have setup their roles correctly and also made entry to their web.config but still their authorization doesn't work. Even they have allowed access to their role that user cannot access particular page/folder. The common reason for that is placing <deny../> before <allow ../>.
Say the web.config from AdminFolder as we have seen before is something like this:
 //This web.config will not allow access to users even they are in Admin Role
  <configuration>
    <system.web>
      <authorization>
        <deny users="*"/> // deny everyone else
        <allow roles="Admin"/> //Allows users in Admin role
      </authorization>
    </system.web>
  </configuration>

 
Resources:
http://weblogs.asp.net/gurusarkar/archive/2008/09/29/setting-authorization-rules-for-a-particular-page-or-folder-in-web-config.aspx
 
 
 






Jul 11, 2013

Default Constraint

 Default Constraint


 -it can be used default value to insert in the column


 Example 1:


 create table Person(id int,city varchar(20) Default 'INDIA')

 insert into Person values(1,default)

 select * from Person

 Example 2:


 create table PerDate(id int,Date Date Default getdate())

 insert into PerDate Values(1,Default)

 select * from PerDate


check constraint

check constraint

-it can be used limiting by values are accepted one more values.
-it can be used any logical values expression and true or false logical operators.
-CHECK constraints reject values that evaluate to FALSE. Because null values the Database Engine inserts NULL and does not return an error.

Check Constraint:


 CREATE TABLE Test(Id int  constraint Ck_ID check (LEN(ID)=1))

 INSERT INTO Test values(null)

 (1 row(s) affected)

 

 Function Using Check Constraint:


 CREATE TABLE Test2 (ID1 int, ID2 int);

 CREATE FUNCTION CheckingFun()
 RETURNS int
 AS
 BEGIN
 DECLARE @val int
 SELECT  @val=COUNT(*) from Test2
 RETURN  @val
 END;

 ALTER TABLE Test2 ADD CONSTRAINT CH_ID CHECK(dbo.CheckingFun()>=1)

 INSERT INTO Test2 Values(10,10)

 (1 row(s) affected)

Jul 10, 2013

Identity in SQL server

Identity:

Creates an identity column in a table. This property is used with the CREATE TABLE in increment values.

IDENTITY [ (seed , increment) ]

It can be used identity values to off or on.

SET IDENTITY_INSERT Test on

SET IDENTITY_INSERT Test on

 create table Test(Id int identity(1,1))
 insert into Test  DEFAULT VALUES

 create table Test1(Id int identity(1,1))
 alter table Test Add name varchar(20)
 insert into Test (name)values('munish')




DBCC CHECKIDENT

DBCC CHECKIDENT (Test, RESEED, 0)
DBCC CHECKIDENT (Test, NORESEED)


Recent Posts
Popular Articles

 

© 2013 MUNISH ORACLE DBA& .Net Developer. All rights resevered. Designed by Templateism

Back To Top