Pages

Search This Blog

Monday, August 29, 2011

[SQLServer] Why SQL Server is better than any other RDBMS Applications? Part 2

I like SQL Server because of its SIMPLICITY. I learned SQL commands over Oracle (ah! it was too long that I used oracle and never touched it again after being FRIENDLY with SQL :) ).
I like following attributes of SQL Server hence I loved this one… and as I am trying to deep dive into technology I am being passionate lover… :)
1. First thing I liked is as said its SIMPLICITY.
2. Easy Availability– one don’t have to pay huge bucks to make SQL Available.. he can use Express edition available free.
3. Uncomplicated installation process – follows the same standard as of other MS Product like MS-Office etc… that no one need special knowledge of installation process to get ready to use SQL.
4. Can be install on Average system – like few other RDMS, SQL do not have special hardware requirement. so one can be benefited without having his/her system upgraded.
5. User friendly UI. again abide to MS standard for all other application so anyone feel friendly on first visit.
6. Easy navigation through common shortcuts and tool box. I don’t have to remember multiple keys to navigate.. what works in MS-Office / VS etc.. almost works in SQL as well.
7. BOL – help documentation is easily available and more friendly to browse to get the correct help.
8. Perfect match for all level of organizations… small firms to big enterprise to data store.
9. Perfect suite of application – good clubbing and packaging of Database engine, Agent Service, Notification Service, Reporting Service, Analysis Service, Integration Service.
10. Support for Multi- Instance and side by side installation of multiple versions.
11. Enhanced Security
12. Enhanced Optimizer
13. availability for various technologies to support high availability like Log Shipping, Replication, Clustering, Mirroring etc..
14. Easy to tune up, one can easily tune up the performance with help of wizards and additional tool like Profiler etc litle knowledge.
15. Advancement in the technology.. like SQL Azure, CLR integration, DAC, Intellisense (though I didnt like current intellisense but it helps often).
16. Broader community – I like the SQL community, in Fact I have sharpened my skill through this community.. where you can easily catch up with SQL MVP or MS SQL Team. I love dedication you guys shown up in communities. I believe that if someone is in crisis, this community will never let him get down with SQL.
17. non ANSI functions in SQL are similar to other programming languages hence feels comfortable and don’t have to dig more to find the right function that is equivalent in something like in .net.

SOURCE: COPIED FROM A CONTEST - 1 RUNNER UP POST

[SQLServer] Why SQL Server is better than any other RDBMS Applications? Part 1

SQL Server is like most RDMS systems, a database engine but what make it better than other RDMS systems (especially SQL 2008 onwards) are new features and other bells and whistles it comes with.
Here are the few:
1. Easy integration with Microsoft Operating systems.
2. East integration with world’s most common database: Spreadsheet, Microsoft excel in particular and power pivot has significantly enhanced its value.
3. User friendly interface
4. Easy to create maintenance plans.
5. Integrated Security (windows authentication): This definitely help streamline server access based on Active directory policies and groups.
6. Mixed Authentication: Not only it gives the option to use windows authentication, it allows other applications to authenticate based on username and password
7. Disaster recovery: SQL Server is very easy to restore after a disaster (proper backup and recovery strategy needs to be implemented) as compared to other RDMS. All you need is File system restore followed by system state and then restore databases from backup. I have been involved in DR for a lot systems and doing DR on a SQL Server is much easier than any other RDMS system. Other benefits include Failover Clustering and Transaction Replication
8. Licensing: The licensing structure of SQL Server is much better as compared to other RDMS systems. Other RDMS systems have a very complex licensing structure which comes out to be much costly than SQL Server.
9. SQL Server Management Studio (SSMS): As compare to other RDMS systems tools, SSMS is the best tool for a developer or a DBA.
10. SQL Server Business Intelligence: Business Intelligence in SQL Server has come a long way and has evolved so much. It is one of the best if not the best in the market at the moment.
Since SQL Server Integration Services, SQL Server Analysis Services and SQL Server Reporting Services comes with the SQL Server license, customer doesn’t need to spend extra money on these additional tools, instead that money can be spend on something else e.g. upgrade SAN, user training.
11. Visualization
12. Administering and Monitoring: SQL Server 2008 R2 has really scored high in its new administration and monitoring tools. It has made the life of a DBA (even accidental DBA) a lot easier.
13. Backup Compression: Even though it is a new feature in SQL Server 2008, it has really helped companies to upgrade to the new version and speeding a lot (if not all) of the backup operations.
14. Data Encryption: SQL Server 2008 provides a lot of encryption options to encrypt data and code. Transparent Data Encryption has really safe guarded some of the crucial data movement operations our company.

SOURCE: COPIED FROM A CONTEST - WINNER POST

Friday, August 26, 2011

[SQLServer] SQL Server Value Calculator

Yes, you have data management options.

Considering a better data management solution? Consider SQL Server 2008 Enterprise to efficiently manage your business-critical applications. And with Oracle raising their prices, you can still get a solution based on SQL Server for around a third of their cost.* Do the math on SQL Server value and you’ll see the efficiencies add up.

Wednesday, August 17, 2011

[T-SQL] Contained Database

A Contained Database is a database which contains all the necessary settings and metadata, making database easily portable to another server. This database will contain all the necessary details and will not have to depend on any server where it is installed for anything. You can take this database and move it to another server without having any worries.
The real question is, “What about users who are connecting to this database?” Once the contained database is moved, the users are moved as well, and users who belong to the contained database will have no access outside the contained database.
In summary, “Database is now self-contained. Database which is ’contained’ will not depend on anything on the server where it is installed.”
Let us try out this feature on SQL Server Denali. We will do the following steps:
  1. Enable Contained Database
  2. Create Contained Database
  3. Create User in Contained Database
  4. Try if the user can access outside Contained Database
We can do various tests on this subject; however, in this blog post we will limit out exercise to the above four points.

Enable Contained Database

Run the following code on SQL Server Denali. This code will enable the settings for the contained database.
sp_configure 'show advanced options',1
GO
RECONFIGURE WITH OVERRIDE
GO
sp_configure 'contained database authentication', 1
GO
RECONFIGURE WITH OVERRIDE
GO

Create Contained Database

CREATE DATABASE [ContainedDatabase]
CONTAINMENT
= PARTIALON PRIMARY( NAME = N'ContainedDatabase', FILENAME = N'C:\ContainedDatabase.mdf')LOG ON( NAME = N'ContainedDatabase_log', FILENAME = N'C:\ContainedDatabase_log.ldf')GO

Create User in Contained Database

USE [ContainedDatabase]
GO
CREATE USER ContainedUserWITH PASSWORD = 'pass@word';GO

Try if this user can access out side Contained Database

To test this, we will attempt to login in the database with default settings (where login database is the master).
When we attempt this, we will be not able to login in the server simply because the user does not exist at the server level.
Now, let us try to login in the system using the username which was created in the Contained Database.
You will notice that the login would be successful in the server. When expanded it, the user will have access to the contained database only, and not to any other database.
We will tackle more about this interesting subject in the future.

Reference: Pinal Dave (http://blog.SQLAuthority.com)

Tuesday, August 2, 2011

[T-SQL] Wildcard

Wildcard Basics Recap

Lets start off with something most of us know already. Most SQL folks understand the usefulness and power of the basic uses of wildcards. Using wildcards allows you to do pattern matches in a column. In this case our criteria does not want to use the = sign to find a pattern match. The operator that allows you to do approximate predicates is LIKE. The LIKE operator allows you to do special relative searches to filter your result set.
--Find all LastNames that start with the letter ASELECT *FROM EmployeeWHERE LastName LIKE 'A%'
To find everyone whose last name starts with the letter B, you need “B” to be the first letter. After the letter B you can have any number of characters. Using B% in single quotes after the LIKE operator gets all last names starting with the letter B.
--Find all LastNames that start with the letter BSELECT *FROM EmployeeWHERE LastName LIKE 'B%'

Wildcard ranges or set specifiers

If you want to find all LastName values starting with the letters A or B you can use two predicates in your WHERE clause. You need to separate them with the OR operator.
--Find all LastNames that start with the letter BSELECT *FROM EmployeeWHERE LastName LIKE 'A%'OR LastName LIKE 'B%'
Finding names beginning with A or B is easy. How about the registration desk example where want the names ranging from A-K? This works well until you want a range of A-K as in the example below:
--Find all LastNames ranging from A-KSELECT *FROM EmployeeWHERE LastName LIKE 'A%'OR LastName LIKE 'B%'OR LastName LIKE 'C%'OR LastName LIKE 'D%'OR LastName LIKE 'E%'OR LastName LIKE 'F%'OR LastName LIKE 'G%'OR LastName LIKE 'H%'OR LastName LIKE 'I%'OR LastName LIKE 'J%'OR LastName LIKE 'K%'
The previous query does find LastName values starting from A-K. However, if you need a range of letters, the LIKE operator has many better options. We only really care about the first letter of the last name and there a several first letters that fit with what were looking for. The first letter of the last name can be A,B,C,D,E,F,G,H,I,J or K. Simply list all the choices you want for the first letter inside a set of square brackets.
--LastNames ranging from A to K using a set of 11 lettersSELECT *FROM EmployeeWHERE LastName LIKE '[ABCDEFGHIJK]%'
Square brackets with wildcards enclose ranges or sets for 1 position. In this case the first position is a set of 11 different possible letters. This is not a series of letter but a multiple choice of letters. For example this works regardless of the order you put your letters in. This code sample below does the exact same thing.
--LastNames ranging from A to K using a set of 11 lettersSELECT *FROM EmployeeWHERE LastName LIKE '[KBCDEFGHIJA]%'
Again the set is how many letters you put in the square brackets. The code below is a logical mistake where you won’t get A to K but you just get A or K for the first letter.
--Find all LastNames starting with A or K (MistakeSELECT *FROM EmployeeWHERE LastName LIKE '[AK]%'
Since we’re looking for the first letter to be within a range from A to K, we specify that range in square brackets. This is even easier than using a set. The wildcard after the brackets allows any number of characters after the range.
--LastNames ranging from A to K using a rangeSELECT *FROM EmployeeWHERE LastName LIKE '[A-K]%'
Note: this range will not work if your LIKE was changed to an equal (=) sign. The following code will not return any records to your result set:
--Bad query (it won’t error but returns no records)SELECT *FROM EmployeeWHERE LastName = '[A-K]%'