Forum Replies Created

Viewing 15 posts - 6,871 through 6,885 (of 7,597 total)

  • RE: Group By Inside CASE Statement

    You can use CASE w/i a GROUP BY.

    You can also use CASE w/i a SUM to control which values get aggregated. For example:

    SELECT

    a, b,

    ...

  • RE: Computed column with/with out PERSISTED

    HowardW (1/24/2013)


    SQL* (1/23/2013)


    Hi All,

    While reading about Computed column if found that if we mentioned PERSISTED Key word while creating/altering table then we can create index. But i'm able to create...

  • RE: SQL Index Help..

    IF and only if ABC.COLUMN2 is a (very) large column, and ABC.COLUMN1 is used by itself a lot, it might be worthwhile to keep both indexes.

    You should also review sys.dm_db_index_usage_stats...

  • RE: where fldValue=123 vs join to table with one row

    You need to get rid of the massive GROUP BY; you should be able to do the SUM() in a subquery rather than the main query, but I can't be...

  • RE: How Can I know calling procedure origin?

    AFAIK there's no any accurate way to do that.

    I guess IF every caller used a different login or sql user, you could tell from that, but overall I think that's...

  • RE: Indexed Views - why don't they improve performance?!!!!

    First, I assume you've all met all the oodles of restrictions for an indexed view; you might want to verify that using Books Online "CREATE INDEX", "Remarks", "Indexed Views" as...

  • RE: No Wildcards Characters

    declare @search_pattern_should_be varchar(100)

    set @search_pattern_should_be = '%[[][[][%] SQL Server [%]]]%'

    --example

    select case when @string like '%[[][[][%] SQL Server [%]]]%'

    then'Matched' else 'No...

  • RE: Get distinct value

    I think EXISTS would be the clearest indication that you just want to know if a matching row exists, not retrieve data from that row. For example:

    SELECT

    ...

  • RE: Killed clustered index creation, running out of space

    You should also consider specifying "SORT_IN_TEMPDB = ON" on the creation. That usually saves a little space in the db, and, perhaps more importantly, often makes the final table...

  • RE: How to find if a job ran successfully?

    DBA_Dom (1/23/2013)


    You could also have the last step in the job add a message in a queue for the service broker to pick up and execute the next job.

    Or what...

  • RE: How to find if a job ran successfully?

    Perry Whittle (1/23/2013)


    and all that's easier than a quick check in the dbo.sysjobhistory table??

    Yes: which specific entry for "Job A" does one check in sysjobhistory?

    The last one? What if...

  • RE: Subtracting specific dates from today

    Btw, I suggest using the clear datepart name, not the obscure abbreviations -- it can help you/others later, and avoid having to use Books Online just to lookup the &#^)@...

  • RE: How to find if a job ran successfully?

    That's trickier than it sounds, because of the way SQL Server updates the sysjob* tables, and because you don't want to have to hardcode job schedules into the code.

    Instead of...

  • RE: Grouping Active units by YYYYMM

    Don't know full details, but the usual outline for such queries is shown below.

    SELECT

    DATEADD(MONTH, DATEDIFF(MONTH, 0, tp.trc_startdate), 0) AS start_month,

    SUM(tp.??) AS active_units

    FROM...

  • RE: things to know when designing a new database

    I think what's arrogant is for a developer to assume that they have the professional skills of another a DA/DBA job when they've never done. Not sure why everyone...

Viewing 15 posts - 6,871 through 6,885 (of 7,597 total)