04/11/2012
by Marlon Ribunal
Comments Off on How To Limit User Access To Your Database

How To Limit User Access To Your Database

There are situations where you need to grant SELECT permission to a particular user and limit that access to a particular OBJECT, say a TABLE.

Here’s a quick way of accomplishing this. In this example, we’re using the AdventureWorks2008R2 database.

I have already created the LOGIN in advance (“TestUser01“). Let’s map that to a USER Object:

CREATE USER [TestUser01] FOR LOGIN [TestUser01]
GO

The next step is to set the permission on the particular table we want the user to access:

Grant SELECT To User For A Particular Table

You can further restrict access at the Column Level by setting the Column Permission as needed. Using the HAS_PERMS_BY_NAME  function in SQL Server, let’s check if we’ve granted user TestUser01 the SELECT permission he needed for the Employee table:

SELECT HAS_PERMS_BY_NAME
('AdventureWorks2008R2.HumanResources.Employee', 'OBJECT', 'SELECT')
AS SELECT_PERM,
name
AS TABLE_NAME,
type_desc, schema_id
FROM sys.tables

The HAS_PERMS_BY_NAME  function returns true (1) or false (0) to indicate whether permission has been granted or not.

HAS_PERMS_BY_NAME Function returning TRUE

The good thing about HAS_PERMS_BY_NAME is that, it is accessible to the Public role – meaning Users with minimal access level can run a query containing the function. Or if you are an Admin and you want to test a newly altered user you can impersonate that user:

 

EXECUTE AS USER = 'TestUser01'
GO


SELECT HAS_PERMS_BY_NAME
('AdventureWorks2008R2.HumanResources.Employee', 'OBJECT', 'SELECT')
AS SELECT_PERM,
name AS TABLE_NAME,
type_desc, schema_id
FROM sys.tables
GO


REVERT
GO

 

That should give us the same result shown above. This is how it looks like when TestUser01 logs in to the AdventureWorks2008R2 database:

Limiting User Access to a SQL Server 2008 R2 database

04/04/2012
by Marlon Ribunal
Comments Off on The evolving role of the database professional

The evolving role of the database professional

The role of the database professional is quickly evolving to conform with the ever changing demands of the business world. The new game of the data pro is adaptation.

SQL Server 2012 is responding to Data Explosion and the Cloud

The demarcation between the roles of database administrator and database developer has disappeared. You cannot succeed in one path without succeeding in another. Those two roles – administrator and developer – have been rolled into one just like the two different sides in a coin.

The SQL Server 2012 Certification has responded to this call. If the Professional-level Certifications currently posted on the Microsoft site become final, there will only be two distinct Certifications SQL Server 2012 (and maybe onward) – Data Platform and Business Intelligence, each consists of 5 required exams.

If we take a close look, these two certifications are not really distinct. They share common exams:

  • Exam 70-461: Querying Microsoft SQL Server 2012
  • Exam 70-462: Administering Microsoft SQL Server 2012 Databases
  • Exam 70-463: Implementing a Data Warehouse with Microsoft SQL Server 2012

The Data Platform Certification has the following distinct required exams:

  • Exam 70-464: Developing Microsoft SQL Server 2012 Databases
  • Exam 70-465: Designing Database Solutions for Microsoft SQL Server 2012

While the Business Intelligence Certification has:

  • Exam 70-466: Implementing Data Models and Reports with Microsoft SQL Server 2012
  • Exam 70-467: Designing Business Intelligence Solutions with Microsoft SQL Server 2012

These two certifications are quite different in scope but indistinguishable in function. We can see a reduced separation that used to set apart the Database Pro from the BI Pro. People expect you to know both Administration and BI just because you know SQL Server.

There are discernible implications from these changes:

1. Know the Cloud as a platform

According to Microsoft, the two SQL Server 2012 Certifications are designed to “prove your knowledge and skills in designing, building, and maintaining the next wave of cloud-ready database and information solutions.” The Cloud as a business solution is gaining traction in the business world. It is now becoming a necessity and not simply a storage preference.

2. Know Facts and Dimensions

Businesses are not just looking at data anymore as source for information critical to their day-to-day business operation. With the help of advance database technologies, business people can now easily slice and dice their metadata to produce even more valuable data to boost their fiscal advantages in their market.

3. Know that all Platform Will all Soon Pass

The business of business is the driver of your career. Specialization of one platform or feature is a bane for your career. Generalization is not good either. Remember, demands of business will determine what, when, how and where your career will evolve.

4. Know Adaptation

Continuous learning is imperative. It’s hard to predict what’s down the road five or ten years from now. But if we have the correct knowledge, it’s not hard to read the indicators of what the future will be like.

To sum up, the database as a platform is quickly changing to conform with the demands of business. If you know how to adapt, you’ll have a great chance at succeeding in your career as a Data Pro.

Photo courtesy of flickr user BigSee