17 June 2009, 6:16 pm
If you try to drop a user that owns a schema, you will receive the following error message:
The database principal owns a schema in the database, and cannot be dropped.
In order to drop the user, you need to find the schemas they are assigned, then transfer the ownership to another user or role
SELECT s.name
FROM sys.schemas [...]
14 June 2009, 9:05 am
SQL Server 2008 has now introduced minimally logged inserts into tables that already contain data and a clustered index. What happens is the initial inserts may be fully logged if the data pages they are filling already contain data. However any new data pages added to the table will be minimally logged if [...]
9 June 2009, 9:49 pm
One new feature that SQL Server 2008 offers is more reliable dependency information. SQL Server 2005 offered a DMV (dynamic management view) called sys.sql_dependencies. It is now replaced by a more reliable sys.sql_expression_dependencies.
The following script will show all the procedures that reference a given table name, along with the columns the procedure references [...]
1 June 2009, 4:58 pm
Here is a clean and efficient way to embed carriage returns into a string. I prefer this way instead of concatenating the entire CHAR(13)+CHAR(10) to the end of every string. This replace function also comes in handy in most instances where you need to append strings.
declare @Note varchar (200)
SET @Note = ‘Line One.[crlf];Line [...]