Forum Replies Created

Viewing 15 posts - 7,576 through 7,590 (of 8,731 total)

  • RE: Concatenate Fields, But Evenly Space

    Where are you trying to see the names aligned? Remember that it will depend on your font type.

    A similar approach to Bill's, would be:

    SELECT LEFT( MonthName + SPACE(20), 20) +...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: CDC

    Richard Warr (10/23/2013)


    Raghavendra Mudugal (10/23/2013)There are only 10 types of people in the world, those who understand binary, and those who don't.

    Don't forget the NULLs.

    The column has a NOT NULL...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: How can I get the average number of unique patients per month from a table?

    How would you even calculate the average of active patients? You could count them, but an average needs something from which we could calculate it. Average by doctor? by month?...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Convert and CAst

    As Koen said, date functions are much better for this than manipulating strings.

    Based on your example, this is a way to calculate it.

    DECLARE @para date = '20140201'

    SELECT @para,

    DATEADD( YEAR, -1,...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Are there alternatives to this SQL logic

    Jeffrey Williams 3188 (10/22/2013)


    The only way to get rid of the case expression would be to build a table that contains a cross-map of the values.

    Then in your query you...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Are there alternatives to this SQL logic

    You don't need the RTRIM at all. Here's an example.

    WITH Customer(Source) AS(

    SELECT 'CREDITNEW' UNION ALL

    SELECT 'CREDITNEW ' UNION ALL --Spaces added

    SELECT 'CREDITNEW' UNION ALL...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: ltrim rtrim Causing Floating Field to Round up??

    LTRIM and RTRIM won't chage values of a character string. The problem might be an implicit conversion if your Revenue column is not a character type. To avoid this problem,...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Need to pull the data out of a row and into a comma separated string referencing the columnID

    I'm not really clear on how you want your query, but I believe that this article might help you.

    http://www.sqlservercentral.com/articles/comma+separated+list/71700/

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: combining the result of multiple cursor fetches

    This should give the expected results. However, it's no more than a shot in the dark.

    Check the JOIN on PERSPCODE as I don't know to which table it belongs.

    SELECT l.GROUPID,

    l.POLICYID,

    p.EVENTID,

    RATE,

    SUM(PERSPVALUE)...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Best way to UPDATE with join to other tables...

    Kurt W. Zimmerman (10/21/2013)


    Luis Cazares (10/21/2013)


    Locks will happen on both updates. The difference might be the JOIN type which uses different standards. The first query uses ANSI-92 standard and the...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Best way to UPDATE with join to other tables...

    Locks will happen on both updates. The difference might be the JOIN type which uses different standards. The first query uses ANSI-92 standard and the second one uses ANSI-89 standard....

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: combining the result of multiple cursor fetches

    Hi,

    I'm glad that you found how to solve your problem. However, we might be able to help you to eliminate the cursor and generate your results on a single statement...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Puzzling SQL Update Statement

    The best advice I could give you is to normalize your tables. You have an awful design and you're repeating values with no sense. Table B should only have the...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Converting table-value function to set based query

    This seems to work as desired.

    WITH Scores AS(

    SELECT EVL.Account,

    EVL.Ident1,

    EVL.EvalDate,

    FIL.Module_ID,

    AVG(CASE WHEN ANSWER_VALUE IN (0,1,2,3) THEN ANSWER_VALUE*1.0 ELSE NULL END)*10.0 AS Score,

    DENSE_RANK() OVER(ORDER BY EVL.Ident1 DESC) ranking

    FROM #evalanswers AS ANS

    JOIN #filter...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Removing '.' in SQL server table

    Here's a modification.

    WITH SampleData(String) AS(

    SELECT 'ADB' UNION ALL SELECT

    'ADC. DCD.' UNION ALL SELECT

    'ADC.' UNION ALL SELECT

    'ABC DS.' UNION ALL SELECT

    'AD.' UNION ALL SELECT

    'DG@' UNION ALL...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 7,576 through 7,590 (of 8,731 total)