Forum Replies Created

Viewing 15 posts - 16 through 30 (of 167 total)

  • RE: Modified SP_WHOM

    I've got a Stored Procedure some what like this but I've also added:

    DBCC InputBuffer(<SPId Variable>);

    for each SPId in the result set. It helps to know what command was/is executing.

    One of...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Calculating Duration Using DATETIME Start and End Dates (SQL Spackle)

    [h4]DateDiff tricks and the missing 147 years[/h4]

    Data-type DateTime has the following properties:

    It can represent any valid date/time between 1753-01-01 00:00:00.000 and 9999-12-31 23:9:59.998.

    Declare

    @st DateTime,

    @et DateTime;

    Select

    @st='1753-01-01 00:00:00.000',

    @et='9999-12-31 23:59:59.998';

    Mess with the dates...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Calculating Duration Using DATETIME Start and End Dates (SQL Spackle)

    [h4]More DateTime info...[/h4]

    This time I teased out the internal representation of the DateTime data type. First I ran the following:

    Declare @d DateTime;

    Set @d='1753-01-01 00:00:00.000';

    Select Cast(@d as VarBinary),Cast(@d as BigInt);

    And received:

    0xFFFF2E4600000000...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Calculating Duration Using DATETIME Start and End Dates (SQL Spackle)

    Another bit of SQL weirdness with the DateTime datatype.

    [h4]Setup...[/h4]

    According to BOL a DateTime variable will hold dates ranging from 1753-01-01 through 9999-12-31.

    By not also specifying the time component they judiciously...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Picking Your Packaging

    So many competing issues; and there always will be.

    As the amount data increases and the depth of historical context deepens I find the shops I work in to be moving...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Calculating Duration Using DATETIME Start and End Dates (SQL Spackle)

    Thanks Jeff for the performance analysis. The two main reasons that it is slower are:

    1) Its coded as a scalar function

    2) It also handles days, i.e., it outputs a string...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Calculating Duration Using DATETIME Start and End Dates (SQL Spackle)

    [h4]Try this...[/h4]

    Create Function dbo.ElapsedTime

    (

    @StartTime DateTime,

    @EndTime DateTime

    )

    Returns VarChar(20)

    As

    Begin

    Declare

    ...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: TEMPDB in sqlserver 2012

    If by "scheduled jobs" you are referring to work-load that is using non-SQL mediated disk-space on the same volume containing TempDB, then I'd say your request is just a band-aid...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: How to tell if your code is executing inside sp_ExecuteSQL?

    The sproc only has access to its value of @@NestLevel; there is no "external" or other context to compare it to so it doesn't know about any differential (magnitude of...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: High-Performance Transact-SQL with Window Functions

    Dense_Rank() would be a better choice for your windowing function as it would permit duplicate values to exist in your data islands.



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: FileNameSplitter

    A simple analysis of the file path as a string won't always work. File paths can be constructed such that directory components have periods in them, e.g.,

    C:\MyDirectory\LooksLikeAFileNameButIsReallyADirectory.txt

    A simple string analysis...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: T-SQL Integer Data-Type Conversions

    okbangas (6/26/2012)


    T-SQL type Int is storage-equivalent to VarBinary(4).

    T-SQL type BigInt is storage-equivalent to VarBinary(8).

    This is definitely not so, as varbinary require a VLB (Variable Length Block), whereas int and bigint...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Logical Operators

    Hence the invention of parenthesis... 🙂



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Abort SQL-Script with raiseerror

    Do you really need to use separate batches for your script?

    If not, remove the GOs and use Return and/or conditional Goto's to strategically placed labels.



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Jobs for Data Scientists

    Wow, thanks! Gotta new title to add to my resume!

    Data Scientist... has a certain ring to it, doesn't it!

    I've been doing this for years now on data tables with over...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

Viewing 15 posts - 16 through 30 (of 167 total)