Size of stored procedure



 
Stored procedures are special objects available in sql server
It is a collection of transact sql statements that can take or return user supplied parameters.

It s a p recompiled statements where all the preliminary parsing operations are performed and the statements are ready for execution.

Maximum size of stored procedure is 128 MB.

Check isalphanumeric in sql server

ALTER FUNCTION dbo.ISALPHANUMERIC
(
 @columnfield VARCHAR(5000)
)
RETURNS VARCHAR(5000)
AS
    BEGIN
        DECLARE @splcharposition INT
        SET @splcharposition = PATINDEX('%[^0-9A-Za-z]%', @columnfield)
    WHILE @splcharposition > 0
        BEGIN
            SET @columnfield = STUFF(@columnfield, @splcharposition, 1, '')
            SET @splcharposition = PATINDEX('%[^0-9A-Za-z]%', @columnfield)
        END
        SET @columnfield = @columnfield
    RETURN @columnfield
    END
GO

Multiple onload event in dot net

Definition

Once a page has been loaded 'onload' event executes a JavaScript immediately.

We can use onload function in number of ways:

1. <body onload="load1()">
2. <element onload="SomeJavaScriptCode">
3. object.onload="SomeJavaScriptCode"
4. window.onload = load;

function load1() {
  alert("This is the first.");
}

onLoad Event handlers Examples

<frameset onload="framload()">
<img src="logo.gif" onload="imgload()">

 

USE of onload

 

This is used to invoke JavaScript function after the page or an image has finished loading.

 

How to get requesting page in C#

We can get requesting page url in C# to use below statement
Request.UrlReferrer.OriginalString

We can also check the particular page
if (Request.UrlReferrer.OriginalString.IndexOf("confirmation.aspx") > -1)
            {
// Code Here
                      }
We should include the namespace before that.
using System.Web;

Find iphone browser in c# code

I need to find the site has been opened in mobile browser version or not, if it opened in iphone browser, then i need to redirect other page. So i use UserAgent to find operating system details.

if (Request.UserAgent.ToLower().Contains("iphone") == true)
        {
            //Response.Redirect("mobile.aspx");
        }

to get table names which are referenced by given table

Use this function to get table name which are referenced as foreign key by  given table's primary key

I want to find out that table names in database, a primary key of a table that referenced foreign key of another tables.

Here i have to pass the main table name and find out the tables the primary key of main table referenced the foreign key of another tables.


CREATE FUNCTION [dbo].[getForignkeyTblName1](@tblname varchar(50))
RETURNS @tbl TABLE(tblnames varchar(50))
AS
BEGIN
declare @objid int,@objname nvarchar(776),@result varchar(50)
INSERT INTO @tbl SELECT b.Name FROM sys.foreign_keys a
INNER JOIN sys.tables b
ON a.parent_object_id =b.object_id
 WHERE a.referenced_object_id =(SELECT object_id FROM  sys.tables WHERE name=@tblname)
return
END

--SELECT * FROM [getForignkeyTblName1]('MainTable')

What is Normalization?

Normalization is the process of designing a data model to efficiently store data in a database
  • Database normalization is a data design and organization process applied to data structures based on rules that help building relational databases.
  • In relational database design, the process of organizing data to minimize redundancy is called normalization.
  • Normalization usually involves dividing a database into two or more tables and defining relationships between the tables.
  • The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database via the defined relationships.

What are the Different Normalization Forms?

1NF - Make a separate table for each set of related attributes, and give each table a primary key. Each field contains at most one value from its attribute domain.

2NF -If an attribute depends on only part of a multi-valued key, then remove it to a separate table.

3NF -If attributes do not contribute to a description of the key, then remove them to a separate table. All attributes must be directly dependent on the primary key.

Rules for 3NF
  • To separate table for each set of related attributes, and give a primary key for each table.
  • If an attribute depends on only part of a multi-valued key, remove it to a separate table
  • If attributes do not contribute to a description of the key, remove them to a separate table.