Category Archives: SQL
Microsoft SQL Server: Got Foreign Key Constraint Errors? Here’s How to Find the Foreign Keys in a Database
A foreign key is used to enforce a link between data in two tables. If you are encountering Foreign Key Constraint Errors on a third party database, you can end up pulling out your hair trying to figure it out as SQL Server gives you no quick and easy way to view all foreign keys in a database. There is hope though, as you can list all Foreign Key Constraints in the desired database by executing a query aqainst the database.
Making changes to a database that has been created by a third pary can be a difficult task, especially when you don’t want to break any of the existing stored procedures. You can search the database’s stored procedures for keywords to find which procedures use a keyword that is involved in your change. The result set will contain the name and text of each stored procedure that contains that specific keyword.
SQL Server’s temdb is used for global or local temporary tables, temporary stored procedures, table variables, cursors, storing results for sorting, etc. By default, tempdb is placed on the same drive that SQL Server was installed on and this can cause performance issues, particularly if SQL Server is installed on the server’s boot drive. By moving tempdb to a different physical drive, your server will experience a boost in performance.