Browse by Tags

SQL Server TSQL to find complete CONSTRAINT information on a table catalog?
09 January 08 06:26 AM | SQL Master | 2 Comments   
I have had a requirement to see a detailed information about a constraint on a table that includes table fields, type, rules, referenced table and fields for FOREIGN KEYs, etc. Found this useful TSQL to get such information: SELECT k.table_name, k.column_name Read More...
TSQL to get default location of database data and log files?
08 January 08 05:37 AM | SQL Master | 2 Comments   
By default the SQL Server database data & log files are created on the default data directory which is Program Files or based on where SQL binary files are installed. In order to find what is the default location you can run following TSQL: declare Read More...
TSQL script for deleting backups older than 1 day
10 September 07 02:34 AM | SQL Master | 2 Comments   
Common question and ranting about Database maintenance plans in the forums, in this case I always suggest to use another job using TSQL to drop those older backup files. Andrew Kelly, SQL MVP has contributed an excellent script sample that should get Read More...
TSQL to detect long running queries against the database
29 August 07 04:37 AM | SQL Master | 3 Comments   
When I'm performing a performance analysis on a 24/7 application and dealing with PSS I had been given the following TSQL to identify the long running queries against a database. select r.session_id, s.host_name, s.program_name, s.host_process_id, r.status, Read More...
TSQL to generate a script that updates a column on every table in my database. How do I do this?
29 July 07 01:39 AM | SQL Master | 2 Comments   
SELECT 'ALTER TABLE ' + sysobjects.name + ' ' + 'ALTER COLUMN ' + syscolumns.name + ' ' + systypes.name + '(' + cast(syscolumns.length as varchar) + ') ' + 'COLLATE ' + syscolumns.collation + ' ' + case when syscolumns.isnullable = 1 then 'NULL' else Read More...
Find VIEW ANY Database permission privileges for all users
18 July 07 08:11 AM | satyaskj | 1 Comments   
You may be aware that any login that is created on SQL Server will have permission or privilege to see all databases on that instance. This is due to VIEW ANY DATABASE permission that regulates the exposure of metadata system databases. This permission Read More...
SET TRUSTWORTHY ON when using SP_CONFIGURE
17 July 07 02:09 AM | SQL Master | 1 Comments   
SET TRUSTWORTHY ON, from the name itself it sounds like you are not allowing anything that cannot be trusted. SQL Server 2005 has introduced a new database property called TRUSTWORTHY that is used to indicate whether the instance of SQL Server trusts Read More...