Forum Replies Created

Viewing 15 posts - 391 through 405 (of 417 total)

  • RE: SQL Date Parameters not working

    Whereas:

    >= '20140101' AND < '20150101'

    continues to work accurately for all those data types.

    +1

    Don Simpson



    I'm not sure about Heisenberg.

  • RE: SQL Date Parameters not working

    BWFC (12/4/2014)


    I'm really not following you here.

    declare @startdate datetime = '2014-12-04'

    declare @enddate datetime = '2014-12-05'

    create table #EventHeader(

    HistoryIDint primary keynot null

    ,DateTimeHappened datetimenot null

    )

    insert into #EventHeader

    select 100001, '2014-12-01' union all

    select 100002,...

    Don Simpson



    I'm not sure about Heisenberg.

  • RE: SQL Date Parameters not working

    BWFC (12/4/2014)


    ScottPletcher (12/3/2014)


    BWFC (11/27/2014)


    You're welcome.

    One other thing, be careful using BETWEEN for date range queries. You're usually better using

    where

    [Date] >= @startdate

    and

    [Date] <= @enddate

    Have a look at...

    Don Simpson



    I'm not sure about Heisenberg.

  • RE: What will be the output message?

    Yeah, I've been bitten by text columns when I was unfamiliar with the schema.

    Don Simpson



    I'm not sure about Heisenberg.

  • RE: T-SQL Development Standards

    Jeff Moden (10/25/2008)


    As soon as something needs to "go in in a hurry", all notions of standards and well intended code reviews will go by the wayside.

    +1

    Don Simpson



    I'm not sure about Heisenberg.

  • RE: Alter the schema from one view causes the need to alter the other

    GilaMonster (11/28/2014)


    Or stop using SELECT *

    + 1000

    Don Simpson



    I'm not sure about Heisenberg.

  • RE: Calculate age - Most easiest way

    dave.ott 20779 (12/2/2014)


    I've always liked this to get the age in years

    select cast(datediff(d,@dob,getdate())/365.25 as int)

    This has problems on birthdays. As listed, the code returns 0 when dob = '12/2/2013'...

    Don Simpson



    I'm not sure about Heisenberg.

  • RE: Please vote for the "built in Tally Table" function.

    Voted!

    Don Simpson



    I'm not sure about Heisenberg.

  • RE: SQL Date Parameters not working

    Unfortunately, this is legal ANSI/ISO Standard SQL so it has to work. But you ought to get a warning!

    Rather than defaulting to "1," maybe they could make it work like...

    Don Simpson



    I'm not sure about Heisenberg.

  • RE: IF EXISTS vs @@ROWCOUNT

    Hugo Kornelis (11/26/2014)


    Sorry for the harsh words, but this is absolute rubbish.

    The code in option 2 will always do two lookups. One for the EXISTS, and then another one for...

    Don Simpson



    I'm not sure about Heisenberg.

  • RE: IF EXISTS vs @@ROWCOUNT

    peter.row (11/26/2014)


    I answered neither because neither option answers the question posed.

    You say you have an identity column, you add 4 rows and want to add a 5th.

    Since this is a...

    Don Simpson



    I'm not sure about Heisenberg.

  • RE: Odd Man Out

    Koen Verbeeck (11/20/2014)


    I'd argue ROWCOUNT_BIG is an odd one as well, as it is not calculated over the current result set, but over the results of a previous query.

    +1

    Also, ROWCOUNT_BIG...

    Don Simpson



    I'm not sure about Heisenberg.

  • RE: Memory

    Yep, incomplete information in the question. I'm surprised it got past the gatekeeper(s).

    Don Simpson



    I'm not sure about Heisenberg.

  • RE: Problem with creating a Index on a temp table

    Since it's a one column key, you can put the constraint on the column definition:

    CREATE TABLE [dbo].[#ShipTo]

    ([Ship_to_Num] [int] not null PRIMARY KEY CLUSTERED,

    [Country_key] [nvarchar](3) NULL)

    Don Simpson



    I'm not sure about Heisenberg.

  • RE: Primary Key datatype Bigint vs uniqueidentifier:

    MMartin1 (11/5/2014)


    ... surrogate keys are a data warehouse concept and not in the operational data system ...

    Actually, this is not correct. E.F. Codd introduced the concept of surrogate keys...

    Don Simpson



    I'm not sure about Heisenberg.

Viewing 15 posts - 391 through 405 (of 417 total)