#sql

7 posts tagged sql.

2017 1 post

  1. Updated

    TSQL - Get Index By Table Name + Column Name

    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.

2012 2 posts

  1. Updated

    How many tables do I have in a database (MS SQL)

    Here is a one-liner.

  2. Updated

    Cannot open .SQL file in Visual Studio 2010

    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.

2011 3 posts

  1. Updated

    MS SQL Server 2008 R2 error log growing rapidly

    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.

  2. Updated

    MS SQL drop column with default constraint

    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.

  3. Updated

    Oracle ALTER SEQUENCE - START WITH not working?

    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.

2010 1 post

  1. Updated

    SQL Reporting Services - Fix Border Thickness

    When the report is rendered on the screen in preview mode, it looks okay. However, when it is saved to PDF and/or printed, table borders might have slightly different thickness depending on relative location on the sheet. I believe this issue is related to DPI scaling.