Cursors allow row-by-row precessing of the result-sets. Types of cursors: Static, Dynamic, Forward-only, Keyset-driven. Disadvantages of cursors: Each time you fetch a row from the cursor, it results in a network roundtrip, where as a normal SELECT query makes only one rowundtrip, however large the resultset is. Cursors are also costly because they require more resources and temporary storage (results in more IO operations). Further, there are restrictions on the SELECT statements that can be used with some types of cursors. Most of the times, set based operations can be used instead of cursors. Here is an example: If you … Click here to continue reading.
Suppose we have a table in which a column has Auto-incremented and its value automatically increases on every row. This increasing is depends on the seed and incrementing value. Let us create a table with an auto-increment identity column : CREATE TABLE [TableName] ( [ID] [int] IDENTITY(1,1) NOT NULL, [UserName] [varchar](50) NULL ) ON [PRIMARY]; And now add some data in this table : INSERT [TableName] ([UserName]) VALUES (‘abc’); INSERT [TableName] ([UserName]) VALUES (‘def’); INSERT [TableName] ([UserName]) VALUES (‘ghi’); INSERT [TableName] ([UserName]) VALUES (‘jkl’); If you check all data in this table by using this query : SELECT * FROM … Click here to continue reading.
How to find highest 3 salary in sql? Select top 1 sal from tbl where sal in(select top 3 sal from tbl order by sal desc) order by sal asc. How to find Duplicate entries in sql? Select distinct(sal) from tbl group by sal having count(*)>1; How to delete Duplicate entries in sql? Delete from tbl where id in ( select distinct(id) from tbl group by id having count(id)>1); How to insert row number in sql query? Select row_number() over(order by id),* from table; How we can use try catch in SQL? Begin try Begin transaction ——– ——– Commit transaction … Click here to continue reading.
In SQL Server 2000 the Query Analyzer and Enterprise Manager are separate, whereas in SQL Server 2005 both were combined as Management Studio. In Sql 2005,the new datatype XML is used,whereas in Sql 2000 there is no such datatype In Sql server2000 we can create 65,535 databases,whereas in Sql server2005 2(pow(20))-1 databases can be created. In stored procedure we can write try catch statement in 2005 not in 2000
A data warehouse is a collection of data gathered and organized so that it can easily by analyzed, extracted, synthesized, and otherwise be used for the purposes of further understanding the data.