Comments on: How to Drop A Primary Key in Microsoft SQL Server http://gen5.info/q/2008/06/06/how-to-drop-a-primary-key-in-microsoft-sql-server/ Towards Intelligent Systems Wed, 11 Jul 2012 12:59:08 +0000 hourly 1 http://wordpress.org/?v=3.0.3 By: Generation 5 » Dropping Unique Constraints in SQL Server http://gen5.info/q/2008/06/06/how-to-drop-a-primary-key-in-microsoft-sql-server/comment-page-1/#comment-553 Generation 5 » Dropping Unique Constraints in SQL Server Thu, 26 Jun 2008 19:12:15 +0000 http://gen5.info/q/?p=30#comment-553 [...] the spirit of “How To Drop A Primary Key in SQL Server“,  here’s a stored procedure that queries the data dictionary to find the names of any [...] [...] the spirit of “How To Drop A Primary Key in SQL Server“,  here’s a stored procedure that queries the data dictionary to find the names of any [...]

]]>
By: admin http://gen5.info/q/2008/06/06/how-to-drop-a-primary-key-in-microsoft-sql-server/comment-page-1/#comment-509 admin Mon, 09 Jun 2008 14:23:34 +0000 http://gen5.info/q/?p=30#comment-509 Thanks Adrian! I tested this and then updated the script. It's nice to see what a wealth of information is in the system catalog tables. Thanks Adrian! I tested this and then updated the script. It’s nice to see what a wealth of information is in the system catalog tables.

]]>
By: Adrian Banks http://gen5.info/q/2008/06/06/how-to-drop-a-primary-key-in-microsoft-sql-server/comment-page-1/#comment-505 Adrian Banks Sun, 08 Jun 2008 23:15:17 +0000 http://gen5.info/q/?p=30#comment-505 A better query to find the primary key for the table would be: SELECT [name] FROM sysobjects WHERE [xtype] = 'PK' AND [parent_obj] = OBJECT_ID(N'[dbo].[' + @tableName + ']') This doesn't rely on a naming convention of primary keys' names starting with PK, but instead uses SQL Server's own data on whether the index is a primary key. A better query to find the primary key for the table would be:

SELECT [name] FROM sysobjects WHERE [xtype] = ‘PK’ AND [parent_obj] = OBJECT_ID(N’[dbo].[' + @tableName + ']‘)

This doesn’t rely on a naming convention of primary keys’ names starting with PK, but instead uses SQL Server’s own data on whether the index is a primary key.

]]>

Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /hosting/sites/gen5.info/htdocs/q/wp-includes/class-snoopy.php on line 1148

Warning: fsockopen(): unable to connect to :80 (php_network_getaddresses: getaddrinfo failed: No address associated with hostname) in /hosting/sites/gen5.info/htdocs/q/wp-includes/class-snoopy.php on line 1148