This month’s T-SQL Tuesday topic is SQL Family and is brought to us by Jeffrey Verheul (b/t). It’s an amazing topic, but a difficult one for me to put into words. SQL Family is a lot of things, but at its base it is a group… Read more
When you use the SchemaBinding keyword while creating a view or function you bind the structure of any underlying tables or views. So what does that mean? It means that as long as that schemabound object exists as a schemabound object (ie you don’t remove schemabinding) you are limited… Read more
Quick quiz. Which of these two commands is the opposite of GRANT?
Well lets start with some definitions
- GRANT – Grants permissions on a securable to a principal.
- DENY – Denies a permission to a principal.
- REVOKE – Removes a previously granted or denied permission.
While… Read more
Did you know that whatever columns you pick as your clustered index will be included in any non clustered indexes on the same table? But don’t take my word for it. Let’s take a look!
First things first I’m going to use some AdventureWorks2012 tables to make a test table. Read more
In the previous post I discussed how NULL is basically “unknown”. And any time you compare something to “unknown” you… Read more
This may seem like a question with a simple answer but there is a bit more to it than you might think. In fact I know of 3 possible reasons (and there may be more I don’t know) for seeing a primary key error. Technically they occur for any unique… Read more
I seem to get a lot of permissions questions these days and one of the more frequent ones goes along these lines “I still don’t have the right permissions on database xyq.” So of course the first thing I do is use my handy dandy sp_dbpermissions stored procedure to check… Read more
When I was in college and taking programming classes (back in the days when “a T-Rex ate my 5.25 inch floppy” was a reasonable excuse) we were taught that since the compiler didn’t really see white space we should use it to format our code. And that is absolutely correct.… Read more
Let’s start by assuming that ANSI_NULLS are ON. If you aren’t sure what ANSI_NULLS are exactly, don’t worry, I’ll be going over that in some detail in a future post. However Microsoft tells us that ANSI_NULLS will always be ON in the near future. So we are not going to… Read more
If you want to grant a user the ability to create/alter/delete any table, SP, function etc in a database you have a several options. For example:
- You can grant all of the CREATE permissions either to the database itself or to all of the schemas.
- You can add the user…
I assume that since it’s the second Tuesday of the month that it’s time for T-SQL Tuesday. And you can be certain that Dev Nambi(b/t) has decided to make Assumptions the topic of the 56th T-SQL Tuesday.
I generally like to start with definitions when discussing… Read more
Why is this exciting? A number of months ago Kirsten photo-shopped Argenis into this self… Read more
One of the most powerful tools we have as users of SQL Server is Books Online (BOL). Whether you work mainly as an admin, a developer or in BI, Microsoft has provided a HUGE amount of information for you to use. But BOL is by no means your only resource… Read more
Every now and again you have to put a really long string (more than 8000 characters). Dynamic SQL is the most frequent example where I see this but I do see it elsewhere as well and it’s very easy to make a simple mistake. This is caused by the fact… Read more
These are a couple of stored procedures I wrote to help me with security research. Each of the stored procedures returns three data sets.
- A list of principals and some basic properties about them.
- Role membership
- Object/Database/Server level permissions
Each of the datasets has a set of do/undo scripts… Read more
Creating an alias for a SQL Server is fairly easy and there are several ways to do it. Configuration Manager is my personal favorite. Open up configuration manager and select the SQL Native Client xx Configuration. Under that you will find Aliases.
From here you can add, update or delete… Read more
A couple of weeks ago I did a post on granting or denying permissions to all the tables within a database. However sometimes you don’t want to grant permissions to the whole database at once. This is still pretty easy but there are no built-in roles to do it.… Read more
I frequently see the default trace mentioned in answers to forum questions, blog posts, articles, even training sessions. My knowledge of it after 15+ years with SQL Server unfortunately minimal. I know that it is a trace that is created by SQL automatically (hence the default) and that it is… Read more
A little while back Michael J Swart(B/T) offered to help you become a better writer. This was exciting for me because over the last 2 years (wow I’ve been doing this almost 2 years) I’ve been trying to get better at writing. However getting better… Read more
- An identity column is an auto incrementing column
- An identity column is typically used as a primary key
- A primary key that’s an identity column is usually a surrogate key
- A surrogate key is one that is not related to the contents of the row in any way
- An identity…