Forum Replies Created

Viewing 15 posts - 1,351 through 1,365 (of 1,491 total)

  • RE: Stored Proc with Dyanmic SQL - Headache

    I am glad my efforts sort of worked!

    You are correct, those horrible multi-valued columns need to be dealt with. The following link may give you some...

  • RE: HELP WITH A SIMPLE STORED PROCEDURE

    Asim,

    >>can you tell me how should i take care about this logic below in my stored procedure

    As you have failed to give a cogent description of what you are trying...

  • RE: HELP WITH A SIMPLE STORED PROCEDURE

    Asim

    Microsoft SQL Server is a relational database so rows in a table should have NO order. (Basic theory.) There often is some order but this cannot be guaranteed!

    The...

  • RE: decimal places are being rounded to zero

    If the accuracy of a FLOAT is alright, then just force a FLOAT by adding a decimal point to one of the numbers.

    eg. set @Size...

  • RE: Stored Proc with Dyanmic SQL - Headache

    Carl,

    I see no need for dynamic SQL here as the only thing you are adding to the string is @Crit_Label.

    To speed this procedure up I suggest you:

    1. Convert to static...

  • RE: Transforming a table - logic question

    If possible, normalize the schema although a reporting tool should be able to cope with the current table structure.

    To get the output requested, something like the following should work:

    SELECT

     T.Item_ID

     ,T.Year_ID

     ,N.Nbr AS...

  • RE: Converting date of birth to Age

    Farrell,

    I think the difference is that your quick age calculation just uses the difference in years. As all your BirthDates are in December you should really minus one from the...

  • RE: HELP WITH GROUP BY CLAUSE-URGENT

    You need to group by the formula for TableValue:

    INSERT INTO ClaimCounts (Month_of_file, CalcAction, TableValue, CalculatedValue)

    SELECT

     @Month_of_file_filter AS Month_of_file

     ,'Record Count by Loss Month' AS CalcAction

     ,CONVERT(varchar(4), LossDate, 120) AS TableValue -- change...

  • RE: old non-Y2K software, need ''''update year'''' in date field

    You cannot assign a value to a function. Try something like:

    UPDATE CUSTOMERS

    SET [DATE] = DATEADD(year, 100, [DATE])

    WHERE YEAR([DATE]) BETWEEN 1900 AND 1999

     

  • RE: Converting date of birth to Age

    There are probably better ways, but something like this should work in both SQL2000 and SQL2005:

    SELECT CASE

     WHEN D.Age BETWEEN 20 AND 29 THEN '20-29'

     WHEN D.Age BETWEEN 30 AND 39 THEN...

  • RE: Using Calculated Field/Case Labels in other Calculated/Case Fields

    You can do it via a derived table:

    SELECT

     D.UM

     ,D.UM_DIV

     ,D.UM_DIV * D.QTYORD AS UnitNum

    FROM (

     SELECT S.UM

      ,S.QTYORD

      ,CASE S.um

      WHEN 'ea' THEN 1

      WHEN 'bx' THEN 10

      ELSE 2 END AS UM_DIV

     FROM Sales S ) D

     

  • RE: 10 minutes stored procedure now runs hours and hours

    You could try checking to see if any of the VIEWs point to a different server.

    Also, as you do not seem to be using any aggregate functions, you could remove...

  • RE: Question on improving a query

    Using LEFT JOINs instead of INNER JOINs should solve your immediate problem. Age should always be calculated from DateOfBirth.

     

  • RE: join on beginning of field

    AMacKay,

    You really need to redesign your tables so that the <Customers> table has a PRIMARY KEY called something like customerID int. Then you will need to add customerID as a...

  • RE: Finding expiry and effective date from same column

    The following should work but, like all triangular joins, if you have a lot of rows it would be better to use a cursor. Somewhere between 5000 and 10000 rows...

Viewing 15 posts - 1,351 through 1,365 (of 1,491 total)