Forum Replies Created

Viewing 15 posts - 5,776 through 5,790 (of 7,597 total)

  • RE: Order of collation change and compression

    I'd change the collation first, since I think that will affect the compression. I believe the overall compression overhead, including I/O, would outweigh any advantages gained in I/O.

  • RE: Case statement in the where condition

    But those conditions within the WHERE clause could convolute the query plan and thus the performance.

    Much better to set variables and have a simple and consistent WHERE clause, allowing SQL...

  • RE: Case statement in the where condition

    DECLARE @start_date datetime

    DECLARE @end_date datetime

    IF @parameter = 'GT30'

    BEGIN

    SET @start_date = '19000101'

    SET @end_date = GETDATE() - 30

    END --IF

    ELSE

    IF @parameter = 'LT30'

    BEGIN

    ...

  • RE: Stored procedure with unavailable server reference

    I'm virtually certain you'll get an error if the linked server isn't there.

    You could use dynamic SQL, which will only be compiled if/when it's run.

    As to recompiles, SQL will not...

  • RE: display values upto 1 decimal without function.

    If there's always at least one decimal place:

    SELECT

    value AS original_value,

    SUBSTRING(value, 1, CHARINDEX('.', value) + 1) + '%' AS new_value

    FROM (

    ...

  • RE: IndexOptimize - Log Growth

    The more disorganized the index, the more work space will be needed. Hopefully once you get the tables back in shape, the future runs won't be as bad.

    Also, look...

  • RE: Evaluating a database

    PhilipC (9/16/2014)


    ScottPletcher (9/16/2014)


    I first look at SQL's usage stats (incl. row counts), operational stats and missing index info. Be aware they get reset when SQL stops and restarts, so...

  • RE: data type conversion and performance

    ramana3327 (9/16/2014)


    Hi,

    I can't provide the execution plan but the query is

    select serialnumber from sampletable where id in (1,2,3)

    CREATE NONCLUSTERED INDEX sampletable__IX_id ON sampletable ( id ) INCLUDE ( serialnumber...

  • RE: create column alias with concatenation.

    Another option is to rename the column(s) then use "SELECT *" for output:

    --CREATE TABLER #temp ...

    --INSERT INTO #temp ... ...

    DECLARE @sql varchar(8000)

    SET @sql = 'EXEC tempdb.sys.sp_rename ''#temp.sale'', ''Sales' + CAST(YEAR(GETDATE())...

  • RE: Evaluating a database

    I first look at SQL's usage stats (incl. row counts), operational stats and missing index info. Be aware they get reset when SQL stops and restarts, so you get...

  • RE: Table Record Access Counter

    You could start with a url summary table and add a details table later if you need to.

    I'd still strongly urge you to use an int to represent the url,...

  • RE: data type conversion and performance

    Create an index::

    keyed on : id

    INCLUDE : serialnumber

    Use quotes in the WHERE:

    WHERE id IN ('1', '2', '3')

  • RE: CHECKDB fails on MSDB and Master system databases

    You can really get around that error directly, as SQL has control of master.

    Back up the master db and restore it to a different name.

    RESTORE DATABASE master_dbcc_checkdb

    FROM DISK = 'x:\full\path\to\master.BAK'

    Then...

  • RE: Removing database owner

    You can have odd errors occur in that situation.

    You're better off having a fixed, permanent owner for dbs and granting permissions as needed to other users, up to and including...

  • RE: Replace CASE WHEN expression by boolean logic?

    The second style would at least have a chance of being fully optimized, particularly if you force a recompile of the query. Stick with it.

    I'd avoid the first style...

Viewing 15 posts - 5,776 through 5,790 (of 7,597 total)