Forum Replies Created

Viewing 15 posts - 2,986 through 3,000 (of 5,504 total)

  • RE: counting number of dys in a specified month

    You don't have a "source" defined to apply the WHERE clause to. Your source is a table with one row and one column holding the month of getdate():

    IF Exists (

    SELECT...

  • RE: How to split character from string

    to "quote" Bob Dylan:

    "How many chars can I split with this code

    before it will starting to fail?

    The answer, my friend, is written in the link[/url].

    The answer is...

  • RE: Pivot for weeks

    See the CrossTab link in my signature and change your query accordingly.

    Then read the DynamicCrossTab article (also refernced in my signature) to make it dynamic.

    Give it a try and see...

  • RE: Pivot for weeks

    That's one of the reasons I prefer using the "old-fashioned" cross tab method over PIVOT.

    One of the other reasons is to make it dynamic more easily.

  • RE: Pivot for weeks

    Change COUNT(Product) to COUNT(Week) .

  • RE: Single DELETE statement show high reads

    I'm just guessing that it is caused by the IN clause.

    Why don't you use DELETE FROM <tablename> WHERE Id =10 instead?

    If there is more than one value, use a subquery...

  • RE: Query Execution Performance

    Based on the very limited information provided so far: reduce the number of rows in the table or in your select statement (the former by archiving data and the latter...

  • RE: replacing long running cursor

    I would use the "quirky update" method, assuming you're using SS2K and not SS2K5 or higher (in this case ROW_NUMBER() would be my preferred method).

    The quirky update method is described...

  • RE: Changing an error message in the sys.messages system table

    There are several options I can think of:

    1) Analyze the index job if it can be optimized (e.g. only roerganize/rebuild indexes that need to be touched basd on fragmentation level)

    2)...

  • RE: Weekly Data Pivot

    That's weird...

    Usually the usage of a format file takes care of conversion errors. If not, a staging table could be used to load the data. However, the final table should...

  • RE: Weekly Data Pivot

    You might want to be a little more specific what you're really looking for...

    If you don't want to provide a start and end date, what will be the logic to...

  • RE: Changing an error message in the sys.messages system table

    If you're "unhappy" with the system messages, create your own message and deal with the system generated messages by using a TRY/CATCH block.

    I'd be curious to know the business case...

  • RE: Split characters in a column and insert in new rows

    Aspg (8/16/2010)


    Nobody around !

    Well, that's not really true...

    I, personally, decided not to reply since you're asking for a fix to your loop solution knowing there are alternatives available.

    So, instead of...

  • RE: Weekly Data Pivot

    Hi,

    here's the solution using the view instead of the Tally solution (I only changed @SQL2):

    SELECT @SQL2 = COALESCE(@SQL2,'')

    + ' SUM(CASE WHEN WeekEndDate = ' + QUOTENAME(d.WeekEndDate,'''')

    + ' THEN TotalPageviews ELSE...

  • RE: Find largest between 3 columns for each record

    I would use UNPIVOT (EDIT: or UNION ALL if the system is before SS2K5) to normalize the data and a MAX() aggregation grouped by ClientID.

    For a coded version I'd like...

Viewing 15 posts - 2,986 through 3,000 (of 5,504 total)