Both function are used in Sql server for explicit conversion of data from one data type to another data type. But using convert() function , data will convert in formated manner , not in cast() function.
For Example:-
cast()
cast(data as datatype)
select cast(getdate() as varchar(100))
output -- Nov 29 2010 5:39PM
convert()
convert(datatype,data,formate)
select convert(varchar,getdate(),105)
output -- 29-11-2010
Monday, November 29, 2010
what is optimistic and premistic locking in Database
Optimistic locking assumes that no one would read or change the data while changes are being by a bean
Pessimistic locking would rather lock down the data so that no one can access it
or
In optimistic locking the row will not be locked until the actual update is performed. In order to prevent the lost update issue a version number column will be used. In pessimistic locking the row will be locked at the time when the data is selected from the database. This will prevent other users who want to update the same record. This should not prevent the readers but this behaviour varies from database to database.
Pessimistic locking would rather lock down the data so that no one can access it
or
In optimistic locking the row will not be locked until the actual update is performed. In order to prevent the lost update issue a version number column will be used. In pessimistic locking the row will be locked at the time when the data is selected from the database. This will prevent other users who want to update the same record. This should not prevent the readers but this behaviour varies from database to database.
Monday, November 22, 2010
What are Magic tables in SQL SERVER
There are two magic tables named inserted and deleted.
On Insertion :
whenever an insert takes place, the data goes into inserted
table before the commit of the transaction.
On Deletion :
Whenever a row gets deleted from a table, data goes into
deleted table.
On Update :
Since an update statement is a combination of delete and
insert so in case of update data goes in both, inserted and
deleted tables.
On Insertion :
whenever an insert takes place, the data goes into inserted
table before the commit of the transaction.
On Deletion :
Whenever a row gets deleted from a table, data goes into
deleted table.
On Update :
Since an update statement is a combination of delete and
insert so in case of update data goes in both, inserted and
deleted tables.
Subscribe to:
Posts (Atom)