Forum Replies Created

Viewing 15 posts - 3,871 through 3,885 (of 8,731 total)

  • RE: complicated sorting parent and child records

    Can you define "not working" and post expected results based on the new sample data?

    P.S. Your new sample data doesn't have the same DDL as the previous one.

  • RE: Job Schedules

    david.gugg (11/10/2015)


    Our main software is a third party solution with a legacy database that stores all it dates in a format similar to that: CYYMMDD, where C = Century =...

  • RE: complicated sorting parent and child records

    Probably something like this?

    SELECT c.KeyProductControlDisplay,

    c.KeyProductControlDisplayParent,

    c.ProductCaption,

    c.FormOrder

    FROM [dbo].[xyzabc11] c

    LEFT

    JOIN [dbo].[xyzabc11] p ON c.KeyProductControlDisplayParent = p.KeyProductControlDisplay

    ORDER BY ISNULL(p.KeyProductControlDisplay,...

  • RE: Job Schedules

    iain.jacob 29849 (11/10/2015)


    There is always another way...

    WHERE js.next_run_date = cast(convert(varchar(8),GETDATE(),112) as int);

    I'll just drop the var part as you'll never have a different length.

  • RE: Job Schedules

    Larnu (11/10/2015)


    You could also use format (as below), if using SQL Server 2012 or later.

    where js.next_run_date = cast(format(GETDATE(), 'yyyyMMdd') as int)

    Cheers!

    Knowing format is several times slower than any other alternative,...

  • RE: DY

    drew.allen (11/9/2015)


    Luis Cazares (11/9/2015)


    How can a question and an affirmation be self-contradictory? I'm making the question because those are self explanatory for me, but if someone asks me what they...

  • RE: Create Procedure

    TomThomson (11/9/2015)


    Got it shan't ask any more question, take this to mean support questions too, so will try google in future! Thought this was a supportive community. apparently not! Sorry...

  • RE: How do I model this?

    Have you read about slowly changing dimensions type 2? It seems to be what you need.

  • RE: Split time span into multiple records

    You're welcome.

    Now that I think about it, this might work better as an inline table valued function. I don't have time to test this right now, but it could be...

  • RE: Are the posted questions getting worse?

    It seems to copy the OP for forum threads and then link to the thread to "read the full article". I'm not sure how that should be considered. And I'm...

  • RE: Split time span into multiple records

    You're right, there's an error on the calculation that must be fixed for issue #1.

    To fix it, the JOIN condition should look like this:

    JOIN cteTally t...

  • RE: Are the posted questions getting worse?

    Does anyone here knows the site howtosql.com? I was searching for an old thread on Google and found that "I'm an author" for them. It was actually linking to forum...

  • RE: sp_executesql, dynamic sql, and openrowset: parameters not being replaced by values in

    By the way, it seems that you're using INSERT INTO SELECT...FROM OPENROWSET when a BULK INSERT with a proper format file would be more appropriate, unless the double quotes are...

  • RE: sp_executesql, dynamic sql, and openrowset: parameters not being replaced by values in

    OPENROWSET doesn't allow variables. You need to concatenate the values.

    I'm assuming certain things in this example:

    DECLARE @LocalSQLFilePath NVARCHAR( 500) = 'c:\path\file.txt',

    @LocalSQLFmtFilePath NVARCHAR( 500) = 'c:\path\file.fmt',

    ...

  • RE: Is date format yyyy-mm-dd safe regardless of the language settings?

    datsun (11/9/2015)


    If I remove all the dashes in yyyy-mm-dd and replace with yyyymmdd, then is it safe regardless of the login default language setting?

    Yes

Viewing 15 posts - 3,871 through 3,885 (of 8,731 total)