Forum Replies Created

Viewing 15 posts - 346 through 360 (of 638 total)

  • RE: Help me understand vendor provide calendar table

    How can I incorporate this into a query?

    CREATE TABLE #MyCalendar

    (

    YearMonth char(6),

    BinaryCode int

    )

    INSERT INTO #MyCalendar VALUES ('201205',235673648)

    CREATE TABLE #MyData

    (

    MyDate datetime,

    MyData int

    )

    INSERT INTO #MyData VALUES ('5/1/2012',1)

    INSERT INTO #MyData VALUES ('5/5/2012',5)

    INSERT INTO #MyData...

  • RE: Help me understand vendor provide calendar table

    Brilliant Mr. Miller you are exactly right.

  • RE: Help me understand vendor provide calendar table

    I am trying to walk some kind of line here between describing an issue in general and providing exact DDL. The vendor doesn't support direct database access, they allow it...

  • RE: Need help creating case statements from a query.

    Typically a lookup table like EmploymentStatus will allow your application to populate a related field table in your Employees table.

    In one scenario the description from the lookup table ('Full-Time') would...

  • RE: Help me understand vendor provide calendar table

    Jeff Moden (5/13/2012)


    If you know the table name, why not just list the first 60 rows of data and the DDL to start with?

    I have concerns about contractual vendor agreements.

  • RE: Weird SQl server reboots, what to look for?

    You should look at the SQL Server logs as well as the server level logs.

    Whats the OS?

  • RE: Need help with my date logic function

    It seems IF ELSE can't be used in a function hence the UNION ALL technique. Any way to not call the function 4 times? Or is the performance implication so...

  • RE: Need help with my date logic function

    Thanks! Looks good from the testing I have done.

    DECLARE @Period VARCHAR(50)

    DECLARE @TestDate datetime

    --SET @Period = 'MostRecentYearToDate'

    SET @Period = 'MostRecentCompletedYear'

    --SET @Period = 'MostRecentThreeMonthPeriod'

    --SET @Period = 'MostRecentCompleteQuarter'

    --SET @TestDate...

  • RE: Need help with my date logic function

    Period,Start_Date,End_Date

    MostRecentYearToDate,2011-12-31,2012-04-30

    MostRecentCompletedYear,2011-04-30,2012-04-30

    MostRecentThreeMonthPeriod,2012-01-31,2012-04-30

    MostRecentCompleteQuarter,2011-12-31,2012-03-31

    Both start and end date should always be the last day of the month.

    The function as I posted it 'seems' to be working except for the start date for MostRecentThreeMonthPeriod.

  • RE: Update record if exists else create new

    It sounds like you want to use the MERGE command.

    If you search for MERGE TSQL you will find lots of examples.

  • RE: RS with two date columns from a single date column

    I think you need a full self-join.

    Since you did not provide DDL here is some air code....

    SELECT

    1.Date AS Tag1Date,

    1.Value AS Tag1Value,

    2.Date AS Tag2Date,

    2.Value AS Tag2Value

    FROM YourTable 1

    FULL JOIN...

  • RE: Selecting dates from a fixed period

    Conceptually you want to do something like

    SELECT

    *

    FROM YourTable

    WHERE YOUR ClientCode IS NOT IN

    (

    SELECT ClientCode FROM YourTable WHERE PostedDate > DATEADD(yy,-1,getdate())

    )

    The MAX statement should give similar results. I...

  • RE: Dynamic sorting; ASC VS DESC

    The code maintenance I was referring to is a stored procedure, server side, not client side.

    I need the sorting server side since I am using the top keyword. My client...

  • RE: Dynamic sorting; ASC VS DESC

    The trade off I was referring to would be in code maintenance. Using IF>ELSE I'd have two largely identical blocks of code, one ACS and one DESC. Changes would need...

  • RE: Dynamic sorting; ASC VS DESC

    Thanks all. I think having a usable execution plan is going to take precedent in this case so an IF...ELSE block

    would be my best bet.

    This is not a paging attempt,...

Viewing 15 posts - 346 through 360 (of 638 total)