How do you find which tables have a primary key or foreign key? Here are simple queries for finding tables with primary or foreign keys in a database.
SQL SERVER – Script: Knowing Data and Log Files Are On the Same Drive
At GIDS I talked about keeping data and log files on separate drives. Here is a script that shows which databases have data and Log Files on the same drive.
A Custom db_executor Role for Stored Procedure Access
The app gets a permission error while it works for you as a sysadmin. Here is how a db_executor role fixes it without opening everything.
SQL SERVER – Generate Different Random Number for Each Group Using RAND() Function
The RAND() function returns the same value for every row in a query. Here is a simple trick to generate a different random number for each group.
SQL Server – Error While Enabling CDC on a Table – The specified ‘@server’ is invalid (valid values are returned by sp_helpserver)
A reader got an error while enabling CDC on a table: The specified ‘@server’ is invalid. Here is what the message means and what caused it for him.
SQL SERVER – Different Methods to Know Parameters of Stored Procedure
Need to know parameters of stored procedure code quickly? Here are two methods, including sp_help, that list each parameter with its type and order.
Hey DBA – Watch Your Vendors! Hey Vendors – Try a Little Harder! – Notes from the Field #077
Notes from the Field #077: Mike Walsh asks every DBA to watch their vendors, and asks vendors to try a little harder. Lessons for both sides.





