Thursday, August 16, 2007

stored procedure

Connected Architecture:-
when the application maintains d.b table information by maintain connectivity with datebaseserver,then it is called as C .A
When th....0e application maintains db table information without maintaing connectiveity with db serrver
Recordset can't mainain data from multiple databases.
it doesn't supports constaints.
Rs will manage data internally in the form of ADTG(Active data table gram) format.
This is a binary standard format ZC12089-NBDG-452A
rc cnnot maintain from multipel databases.
rs does not support conditions.
rs will manage data internally in the form under adrg format.
When the application maintain d.b table information by maintain connectivity from db server.
..........................................................................................What is the difference between Userdefined Functions and Stored Procedures in Sql server?..........................................................................................

Stored Proc is a precompiled object which is used to increase the performance of your application.A stored procedure is a program (or procedure) which is physically stored within a database.
Function
A user-defined function is a routine that encapsulates useful logic for use in other queries. It can have multiple SELECT statements
Both functions and procedures can return values. Apart from this following are the differences
1) Functions are used for computations where as procedures can be used for performing business logic
2) Functions MUST return a value, procedures need not be.
3) You can have DML(insert,update, delete) statements in a function. But, you cannot call such a function in a SQL query..eg: suppose, if u have a function that is updating a table.. you can't call that function in any sql query.- select myFunction(field) from sometable; will throw error.
4) Function parameters are always IN, no OUT is possible
5) Function returns 1 value only. procedure can return multiple values(max. 1024)
6) Stored Procedure :supports deffered name resoultion Example while writing a stored procedure that uses table named tabl1 and tabl2 etc..but actually not exists in database is allowed only in during creation but runtime throws error Function wont support deffered name resolution. Stored procedure returns always integer value by default zero. where as function return type could be scalar or table or table values(SQL Server). Stored procedure is pre compiled exuction plan where as functions are not.
7) A procedure may modifiy an object where a function can only return a value
-------------------------------------------------------------------------------------------------------------------------------------------------------------Template Column:-
This column will act as a container for placing web server control within datagrid.
Paging:- Paging is a concept of maintaining the db tables information into different blocks.where each block is called as page.Datagrid will present only one page information at a time to the client.This is recomnaded when there is more no of records.
functions are used for computations .As procedures can be used for performing business logic.
function must return for single value.Procedure ned not be.function return a value and procedure returns multiple values..(max1024) A procedure may modify object ,where a function can only returns a value.function praarameters are always In.no out possible.
s.p is a compilation object which is user to increase the performence of ur application.s.c is a programe which is stored in db
udf:-userdefined function is routine encapsulates useful logic for use the other quires.It can have multiple select statements
Typed Dateset :-
A Typed dataset is a class inherited from dataset class with additional properties & mtds called as strongly typed properties & methods. Fuatures of typed dataset...1) it will make developer job easier.2)It provides more clarity to the application.3) It will change the datatype of the application

difference between trigger and stored procedure

Actually triger in action which is performed automatically before or after a event occur and stored procedure is a procedure which is executed when the it is called. Stored procedure is module.

1. Triggers are implicitly called by DB itself while SP has to be manually called by user.
2. SP can pass the parameters which is not a case with Triggers.
3. While creating a Trigger, triggering event n action has to be specified, which isn’t a case with SP.
4. A Trigger can call the specific SP in it but the reverse is not true.

Stored procedures are compiled collection of programs or SQL statements that live in the database. A stored procedure can access and modify data present in many tables. Also a stored procedure is not associated with any particular database object. But triggers are event-driven special procedures which are attached to a specific database object say a table. Stored procedures are not automatically run and they have to be called explicitly by the user. But triggers get executed when the particular event associated with the event gets fired. For example in case of a database having say 200 users and the last modified timestamp need to be updated every time the database is accessed and changed. To ensure this one may have a trigger in the insert or update event. So that whenever any insert or update event of the table gets fired the corresponding trigger gets activated and updates the last modified timestamp column or field with the current time. Thus the main difference between stored procedure and trigger is that in case of stored procedure the program logic is executed on the database server explicitly under eth user’s request but in case of triggers event-driven procedures attached to database object namely table gets fired automatically when the event gets fired.

No comments: