Forum Replies Created

Viewing 15 posts - 1 through 15 (of 287 total)

  • RE: random records

    The Dixie Flatline (3/4/2014)


    Lamprey13 (12/16/2010)


    Here is another method I've seen/used that is pretty similar to the ORDER BY NEWID(), but much faster:

    SELECT TOP 10 * FROM MyTable

    WHERE 0.01 >= CAST(CHECKSUM(NEWID(),...

  • RE: random records

    just a small note. Which method you choose may depend on your environment. By that I mean some environments are more disk bound that CPU, some vice sera, etc.

    If you...

  • RE: Improving SSIS Update Performance

    brettk (10/31/2013)


    Dunno if it's worth mentioning, but the downside to the tmp table + update option is the lack of SSIS-level, row-by-row error reporting (which makes sense given you're operating...

  • RE: Improving SSIS Update Performance

    If you are looking for performance in a bulk-update scenario, you might want to look into using a View with an Instead Of trigger. That way you can "bulk insert"...

  • RE: if with a datepart and a THEN......???

    Forgot my sample:CASE

    WHEN DATEPART(MM,OrderDate) = 12

    THEN (APPT_RPT_APPOINTMENT.DURATION / 60)

    ELSE NULL

    END AS Decschedhours

  • RE: if with a datepart and a THEN......???

    If you are trying to generate a column, then you should probably use a CASE expression. An IF statement is used for flow control.

  • RE: DELETE Statements when using a JOIN - Best Practice

    There is also the MERGE statement.

  • RE: Database Designing issue

    Koen Verbeeck (12/22/2011)


    <snip>

    It is perfectly acceptable to have a denormalized database design in a relational database, for example in a data warehouse. SQL still works, and it is still pretty...

  • RE: Prioritize a JOIN - get just one option

    Yeah, GSquared solution won't work with your sampel data, that's why I posted an alternate solution.

    Try this:SELECT *

    FROM

    (

    SELECT...

  • RE: Prioritize a JOIN - get just one option

    I'm not usre of your actual data since none was supplied, but if GSquared's solution doesn't work perhaps you can use this:

    DECLARE @T1 TABLE (Col VARCHAR(2))

    DECLARE @T2 TABLE (Col VARCHAR(2))

    --INSERT...

  • RE: Convert String to Binary and vice versa.

    I'm not clear if you want to encrypt/decrypt a string or just convert it to binary. So, here is s way to to Cast to binary and back again:DECLARE @string...

  • RE: Date with Time

    I wouldn't explicitly covert a date to a string and then implicitly back to a date. Depending on your version of SQL you can use:SELECT

    CAST(CURRENT_TIMESTAMP...

  • RE: Alias vs Assignment operator

    Bascially one (AS clause) is ISO compliant and the equal-sign is not. According to BOL:

    The AS clause is the syntax defined in the ISO standard for assigning a name to...

  • RE: Wondering Reason(s) Records Would Not Be Updated

    I'd highly doubt it's a SQL issue, but there are several things that people do in SQL that could have unexpected consequences.

    Using MERGE, for example, can have unexpected results given...

  • RE: Datetime conversion

    Are you just looking for the first and last day on the currnet month?

    If so, maybe this will help:SELECT

    DATEADD(MONTH, DATEDIFF(MONTH, 0, CURRENT_TIMESTAMP), 0),

    ...

Viewing 15 posts - 1 through 15 (of 287 total)