Wednesday, June 27, 2007

Sql Server : Under the HOod

Just experimenting with a few things in sql Server 2000

Rules
raiserror
User Defined Data Types
SYSOBJECTS
Check constraints

A Couple of Stored Procedure
SP_BINDRULE
SP_UNBINDRULE

Lets take up one by one...

Rule : A constraint that can be applied to a particular column or User Defined Data Type (UDT)

Syntax : create rule RuleName
as
Condition_Expression

Example : Create Rule RuleOne
as
@EMPNO <> 5

So now, to apply this newly created rule to a Table Column or UDT, We use the Stored Procedure, SP_BINDRULE.

Syntax
SP_BINDRULE [ @rulename = ] 'rule' ,
[ @objname = ] 'object_name'
[ , [ @futureonly = ] 'futureonly_flag' ]

This Procedure takes 3 arguments

1) Rulename : The Name of the rule which we want to apply
2) ObjectName : Name of the Table Column or UDT.
3) Futureonly : If this field is set, it means the contraints applies in future and not for information already existing in the database.


Example1 : sp_bindrule RuleOne, 'Sandy'

Here, RuleOne is the Name of the Rule and 'Sandy' is a UDT

Example2 : sp_bindrule RuleOne, 'TableName.ColumnName'

NOTE : ONLY ONE RULE CAN BE APPLIED TO A COLUMN OR A UDT.

The Exising Rule , If any willl be overwritten.

SP_UNBINDRULE is used to remove a rule from a Column or UDT.

Syntax

Sp_UNBINDRULE
[@objname =] 'object_name'
[, [@futureonly =] 'futureonly_flag']



Arguments,

1) Object Name
Name of the Table Column or UDT.
2) futureonly
If it is set , then Existing columns of the type 'UDT' wil not loose the Constraint, but future UDT columns will not have this Constraint.


DROP RULE RuleName : is used to drop the Rule.

RAISERROR :
Returns a user-defined error message and sets a system flag to record that an error has occurred. The client can either retrieve an entry from the sysmessages table or build a message dynamically with user-specified severity and state information.

Will post more information about the same in my next post....

Tuesday, June 19, 2007

Playing with OOPS

I have 3 classes

class A, B and C.

In class A and class B, i've a data member : public int i;

ill inherit class B from A.

class B : A

After this, i've two variables "i" having the same name.

Now , can i access both the values just one using one object ??

I can use base in C# and mybase in vb.Net, but i dont want to use them in constructor..

If, i have one more class like this..

class C : B

Then, in class C, can i create a single object, using which i can access both the base class A and Derived Class B's data member "i" ?

Stilll looking for an answer/solution.

Hope i find one soooner...........

Monday, June 11, 2007

Sql Server 2000 : Maximum Capacity Specifications

Found this piece of info in MSDN !

The Maximum Capacity Specifications in Sql Server 2000/97




Columns per SELECT statement : 4096

Columns per INSERT statement : 1024

Nested stored procedure levels : 32

Nested subqueries : 32

Nested trigger levels : 32

Parameters per stored procedure 1024

Tables per SELECT statement 256


The sum of the number of all these objects in a database cannot exceed 2,147,483,647.




Check out more information @

http://msdn2.microsoft.com/en-us/library/aa933149(SQL.80).aspx




Cheerz !