Add user with DDL Trigger
DDL trigger will add a user to a newly created database and assign db_owner role. It can be modified for what role is required.
2015-03-12 (first published: 2013-08-22)
1,615 reads
DDL trigger will add a user to a newly created database and assign db_owner role. It can be modified for what role is required.
2015-03-12 (first published: 2013-08-22)
1,615 reads
This script will store all index definitions into a table that you can use to "re-create" the indexes at a later date.
2015-03-11 (first published: 2013-08-26)
2,773 reads
2015-03-10 (first published: 2015-02-16)
1,419 reads
This script shows the COMPLETION datetime of database restore.
2015-03-06 (first published: 2013-09-04)
1,243 reads
Execute the code after passing database name on which you want to restore and the path where your backup file being located.
e.g exec sp_restoredb N'mydatabase',N'D:\mydatabase.bak'
2015-03-05 (first published: 2013-09-22)
1,889 reads
I wrote this query that helps us find executed queries with most number of execution counts. The DMV that we have used in this script is sys.dm_exec_query_stats and the function that we have used is sys.dm_exec_sql_text.
2015-03-04 (first published: 2013-09-23)
5,109 reads
Compare the logins and users on two instances and generate a TSQL script to make them the same.
2015-02-26 (first published: 2013-11-15)
2,847 reads
Determine when a Stored Procedure was created and last altered.
2015-02-25 (first published: 2013-12-26)
3,452 reads
Generate script to drop any unwanted user created statistics.
2015-02-24 (first published: 2013-12-26)
1,517 reads
I have received some comments on getting total space of table and all indexes. Therefore I rewrote previous query and it returns total space used, space used by heap table or clustered index and space used by non-clustered indexes.
2015-02-23 (first published: 2014-01-18)
3,159 reads
By Chris Yates
There are moments in technology when the ground shifts beneath our feet. Moments when...
Why Developers Shouldn’t Have sysadmin access in SQL Server 7 reasons—and exactly what to do instead It...
By Steve Jones
ecstatic shock – n. a surge of energy upon catching a glimpse from someone...
I have noticed sp_executesql also makes a single plan for a stmt with parameter...
Comments posted to this topic are about the item Find Invalid Objects in SQL...
If I want to track which login called a stored procedure and use the value in an audit, what function can I use to replace the xxx below?
create procedure AddNewCustomer @customername varchar(200) AS BEGIN DECLARE @added VARCHAR(100) SELECT @added = xxx IF @customername IS NOT NULL INSERT dbo.Customer ( CustomerName, AddedBy ) VALUES (@customername, @added) ENDSee possible answers