Forum Replies Created

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

  • RE: Halloween

    And as everybody knows, the best tricks involve pyrotechnics! I say points for everybody except those stocking-stuffers!

  • RE: Best Way to Calculate Age

    The best function to use for calculating age is:

    DATEDIFF(yy, @DateOfBirth, GETDATE()) -

    CASE WHEN (DATEPART(m, @DateOfBirth) > DATEPART(m, GETDATE()))

    OR(DATEPART(m, @DateOfBirth) = DATEPART(m, GETDATE())

    AND DATEPART(d, @DateOfBirth) > DATEPART(d,...

  • RE: ANSI_NULLs

    It does appear that the default settings for databases in SQL 2005 do have the ANSI_NULLS values set to OFF. But the reverse seems to be the case for queries...

  • RE: Decision in a query

    This a perfect scenario for a case statement.

    Select case when AddressHome = "" then AddressPO

    else AddressHome end as Address

    from table

    This assumes the...

  • RE: SP - Stored Procedure

    If you do go with passing the table name in and using dynamic SQL in your queries, it is suggested that you first validate the text that came in before...

  • RE: passing parameter in SP

    First, use the dateadd function instead of trying to subtract an integer from a date (i.e. use dateadd(day, -2, getdate()) instead of getdate()-2) to make sure that the parameter you're...

  • RE: complex programing HELP-Stored Procedure insert value after value like this into #temp_table

    DECLARE @Sequence TABLE

    (

    Modulo INT,

    Value INT

    )

    INSERT INTO @Sequence

    (Modulo,Value)

    SELECT 0,1 UNION ALL

    SELECT 1,1 UNION ALL

    SELECT 2,2 UNION ALL

    SELECT 3,2 UNION ALL

    SELECT 4,3 UNION ALL

    SELECT 5,3 UNION ALL...

  • RE: complex programing HELP-Stored Procedure insert value after value like this into #temp_table

    Build a lookup table with shift_index and shift_code as follows:

    shift_index shift_code

    0 ...

  • RE: Rolling up union queries

    The query you provided will work, with a few minor fixes. The only changes I put in are in caps below, along with a missing comma in the first select...

  • RE: Default parameters & Output parameters nightmare

    I think the easiest fix to your current code would be the following. Don't try to convert the input parameters, but do check the values as they are being inserted...

  • RE: TSQL query

    A query like this will give the report you're looking for. The trick is to perform a subquery to return some valuess that can be used to identify the target...

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