Forum Replies Created

Viewing 15 posts - 3,496 through 3,510 (of 4,085 total)

  • RE: How to check only the numeric values at the same time ignoring the symbols or characters using SQL queries

    Peter Brinkhaus (11/11/2011)


    drew.allen (11/11/2011)


    Peter Brinkhaus (11/11/2011)


    No need for a string splitter. Also Cadavre's solution can be simply modified to leave out the false positives:

    Your solution is not SARGable. If...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How to check only the numeric values at the same time ignoring the symbols or characters using SQL queries

    Peter Brinkhaus (11/11/2011)


    No need for a string splitter. Also Cadavre's solution can be simply modified to leave out the false positives:

    Your solution is not SARGable. If you care at...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Finding previous Saturday

    Adi Cohn-120898 (11/11/2011)


    One way is to calculate the number of days that passed since your date, then divide it by seven and multiply it by seven. Since the function...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Finding previous Saturday

    Cadavre (11/11/2011)


    Try this: -

    SELECT DATEADD(DAY, DATEDIFF(DAY, 5, @calenderDate) /7 * 7, 5)

    This doesn't work for dates falling on Saturday, it will give you the current Saturday rather than the previous...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Issue with Trd_linked column

    shalini72011 (11/10/2011)


    Hi,

    I have a requirement to check why the Trd_Linked column is getting 'N' for legal 206337

    UPDATE #Rpt SET Trd_Linked = 'N' --setting default value...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SQL conundrum

    Dan Williams-449672 (11/10/2011)


    And regarding the availabilities ending at 23:59, that was just an example to show someone was available for the whole day. People can set availability that run over...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Selecting 'x of y' in one query

    BrainDonor (11/9/2011)


    INSERT INTO TestResult(Total)

    SELECT CONVERT(VarChar,Count(*) + 1)

    FROM dbo.TestData

    WHERE 1=1

    + ' of ' +

    (SELECT CONVERT(VarChar,Count(*) + 1)

    FROM dbo.TestData

    WHERE 1=1);

    The posted code is missing a paren.

    It's looking for records where

    WHERE 1...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: sp_executesql : Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'.

    You can also use nvarchar(max) which replaces ntext.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Need to run a Select on a table for a specific time of day

    It's best NOT to use BETWEEN when using datetime ranges. You should use the following instead

    WHERE YourDate >= StartDate

    AND YourDate < EndDate

    This will prevent you from double counting any...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SET BASED QUERY

    I assumed that Table A was a staging table of some kind and that the OP was trying to move data to Tables B and C.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SET BASED QUERY

    The other option is to use the OUTPUT clause to return ALL of the new IDs rather than just the LAST new ID that you would get with scope identity.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SQL conundrum

    There are problems with your data model that make this problem more difficult. Specifically, it allows conflicting values. For example,

    SELECT '7','Nov 16 2011 12:00AM','Nov 16 2011 11:59PM','Available' UNION...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Calculate Current Week and 4 Previous Weeks - Week Starting On Sunday

    Welsh Corgi (11/8/2011)


    I probably won't be able to use this for the SSIS Excel Worksheet as Dynamic Headers followed by the Output from a CTE.

    If SSRS is a possibility, it...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SQL conundrum

    Dan Williams-449672 (11/8/2011)


    any ideas or am i heading down the wrong road?

    You're definitely headed down the wrong road, but without easily consumable sample data and expected results, you're unlikely to...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Calculate Current Week and 4 Previous Weeks - Week Starting On Sunday

    You're probably running into problems, because the standard way to do beginning of time period calculations is to use date 0 ('1900-01-01') as the foundation of the calculations. This...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,496 through 3,510 (of 4,085 total)