Forum Replies Created

Viewing 11 posts - 1 through 11 (of 11 total)

  • RE: date conversion

    Here are some samples:

    12/31/2006

    1/1/2007

    12/27/2006

    12/3/2007

    The code above pulls back all the records because the data is currently nvarchar(12) and not datime

  • RE: Connection Problems

    Yes that was the case, I did not know it was the default setting, many thanks:)

  • RE: Can't find a word in a string

    Many thanks for your help

    I need a good Transact SQL book 🙂

  • RE: Checking for a null date

    ah I shifted the if statement inside the begin clause and it accepts it

  • RE: Checking for a null date

    I get an error "incorrect syntax near keyword 'if'.

    alter procedure sp_list_orcon_cat_b_v2

    @start_date nvarchar(19),

    @end_date nvarchar(19),

    @priority nvarchar(1),

    @response integer

    if @end_date is null set @end_date = @start_date

    as

    begin

    SELECT TOP 100 PERCENT id, report_date, priority_text,

    MIN(DATEDIFF(mi,...

  • RE: Using Date Param

    Trader Sam (4/4/2008)


    Whenever possible, you should avoid putting 'functions' in the 'WHERE' clause. Things like 'convert', 'datediff', 'upper', etc.

    It isn't a problem for small datasets, but can be for...

  • RE: Using Date Param

    Trader Sam (4/3/2008)


    Very good point...

    This is why many people use...

    where somedate >= '04/01/2008' --target date

    and somedate < '04/02/2008' --target date + 1

    to get all...

  • RE: Using Date Param

    Trader Sam (4/2/2008)


    bill.humphrey (4/2/2008)


    set @start_date = '24/07/2007 00:00:00'

    I don't believe you need to add the time when setting your start_date, as that is implied...

    '24/07/2007 00:00:00' = '24/07/2007' (when datatyped...

  • RE: Using Date Param

    Ye got it working at last, although it was displaying dd/mm/yyyy as mentioned I still needed to include 00:00:00 but because there was no record for '24/07/2007 00:00:00' I needed...

  • RE: Using Date Param

    I'm pulling a sample date from the dataset when the date parameter is not set so I know the record should qualify the criteria

    Kind Regards

    Bill Humphrey

  • RE: Using Date Param

    OK I tried it but it still returns a blank row and the record exists in the data returned when I don't use the date parameter. I'm using SQL...

Viewing 11 posts - 1 through 11 (of 11 total)