Forum Replies Created

Viewing 15 posts - 8,581 through 8,595 (of 8,731 total)

  • RE: only get data with special pattern

    Would this work?

    However, my guess is that it would perform really bad.

    SELECT *

    FROM @Codes

    WHERE code LIKE 'ABCD%'

    AND PATINDEX( '%[^0-9]%', REPLACE( code, 'ABCD', '' )) = 0

    EDIT: Never mind, stay with...

    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 to get last 5weeks of data from currentdate

    I might be wrong and probably shouldn't give a solution with such few information. If you could provide DDL and sample data, I could test it.

    This should work if your...

    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: Conversion failed when converting the nvarchar value to data type int

    Apart from Lynn recommendation, you don't need to add "ISNULL(Warranty,'0')" if you have "WHERE (Warranty IS NOT NULL)".

    This won't solve your problem (in the article they show your possible solution)...

    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: Case statement within a window function

    Jared,

    The order should be determined by UnitsInStock for each CategoryID, unless there is a zero for any value in UnitsInStock for that particular CategoryID, the order should be determined...

    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: Case statement within a window function

    Amy.G (8/15/2012)


    Luis, You make my query look like a school kid's art project. How do you think up that kind of thing? Thank you!

    hahaha Thank you Amy, 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: Case statement within a window function

    I'm not sure if this will give a good performance. Maybe someone else will come with a better idea.

    SELECT [CategoryID]

    ,[UnitPrice]

    ,[UnitsInStock]

    ,ROW_NUMBER() over (partition by categoryid

    order by CASE when 0 IN...

    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: read the current row and previous row & calculate difference reporting values over

    Do ISO standards say anything about:

    - writing readable code?

    - writing code according to the software's version used?

    - reading previous comments?

    - be aware of the requirements in...

    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: read the current row and previous row & calculate difference reporting values over

    I agree with you Cadavre, but I realized that after posting and realizing the OP was saying devices instead of ids. I corrected it before I saw your new post.

    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: read the current row and previous row & calculate difference reporting values over

    This has been solved in other posts and seems to be a very common issue.

    Here's one solution (I added DDL and sample data in an usable format and you should...

    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 do you use a sub query in a join?

    Have you used one of the solutions we gave you?

    Lowell's might return duplicate rows (because of the extra inner join), but Chris' and mine should not have that problem.

    Could...

    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: When and where should i use left join or right join ?

    Have you read this?

    Using Outer Joins

    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: Passing larger string in variable

    I might have answered too quickly and missed some points.

    SQL Server doesn't manage arrays, just sets of data (tables or results from queries).

    SQL Server won't allow you to assign several...

    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: Passing larger string in variable

    No, but it's possible to do it this way.

    DECLARE @Exam table( exam nvarchar(100))

    INSERT INTO @Exam

    SELECT 'DMDCUMGP' UNION ALL

    SELECT 'DMDSCIGP' UNION ALL

    SELECT 'DATACAVG' UNION ALL

    SELECT 'DATPERAB'

    SELECT *

    FROM

    WHERE .Exam IN...

    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: Format number thousands separator with point

    Sorry, I've just noticed that you asked for dot separators not commas

    Wouldn't this be defined by the regional settings? If the settings affect the format for money, this can result...

    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: Returning all months

    I'm not sure if it will solve the problem without having DDL and sample data to test on.

    My suggestion is to move the condition from the WHERE clause to 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

Viewing 15 posts - 8,581 through 8,595 (of 8,731 total)