Below SQL code will find an index name that corresponds to the given table name and column name pair, and only include those indices with one column (exclude composite indices). Indices can be changed / added / removed by a DBA without impact to the application (part of DB tuning), so it's best not to assume their naming in an application deployment script. This can be useful to remove / replace certain indices without relying on index name.
Here is a one-liner: 1 SELECT COUNT(*) FROM (SELECT DISTINCT table_name FROM INFORMATION_SCHEMA.TABLES) a
Environment hangs, completely at times, or just for several seconds. If it resumes after hanging, you are able to close the tab where this .SQL file would show up. In any case, you cannot see or edit anything in there, seeing this Visual Studio 2010 branded blue background all over the contents area.
MS SQL server 2008 R2 was spamming the error log with the following two messages (got around 50GB of them in 4 days). An exception occurred while enqueueing a message in the target queue. Error 15517, State 1. Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission.
The following MS SQL script will generate MS SQL statements to drop a list of columns with default constraint for a certain table. Need to change table_name and list of columns, as applicable. Statements will be generated only if required.
I googled over many websites explaining the error code and suggesting you do not change it. What if you really need to? One approach is to call NEXTVAL as many times to shift the sequence, so that it starts with your START WITH number (<SW>). A better one is to change INCREMENT BY to a certain value instead, then do NEXTVAL and revert INCREMENT BY.