Forum Replies Created

Viewing 15 posts - 8,521 through 8,535 (of 8,731 total)

  • RE: How to change datatype?

    To a column? or to a variable?

    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: RANK/TOP WITHOUT TIES

    You're right Sean, I missed something.

    EDIT: I need more coffee or to read more carefully.

    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: RANK/TOP WITHOUT TIES

    I had the idea that the group by would do the sort. However, it might not be the safest thing to do it.

    Your query gave me some incorrect results when...

    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: RANK/TOP WITHOUT TIES

    I tested my last solution and won't give the exact results.

    Try this instead:

    ;with MyRank (col1)

    as

    (

    select 6 union all

    select 5 union all

    select 4 union all

    select 3 union all

    select 2 union all

    select...

    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: RANK/TOP WITHOUT TIES

    Another option:

    ;with MyRank (col1)

    as

    (

    select 5 union all

    select 4 union all

    select 3 union all

    select 2 union all

    select 1 union all

    select 1 union all

    select 1

    )

    SELECT TOP 5 col1

    FROM MyRank

    GROUP BY...

    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: Given Letter, Get Next Letter in Alphabet

    You could return a 'Z' or a NULL

    SELECT NextLetter = CASE WHEN ascii(@Letter) IN (122,90)

    THEN NULL --What would you return here?

    ...

    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: Stored procedure in a function

    Please, don't go step by step.

    You have 3 posts very similar and it seems to me that you're not giving us the entire problem.

    If we're aware of the whole context,...

    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 diagnose a query with a sub-query against another server.

    Have you tried a JOIN instead of the IN?

    I've read there can be unexpected problems with cross-server queries.

    SELECT --USE DISTINCT if there are multiple rows in vwCRMServiceProviderAccess

    SP.[ServiceProviderGuid],

    SP.[ServiceProviderTypeGuid],

    SP.[ServiceProviderName],...

    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: find a grouping with at least one row within the group containing a certain value

    Indeed, the query is wrong and it won't take you near to the solution.

    I suggest you to avoid that opinion and stay with Dwain's 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: Make Sequential numbers into ranges

    Next time you should post on the correct forum. 😉

    You could have avoided that Lynn hits his head with the desk.

    Seriously, you can get better answers if you do so.

    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: Make Sequential numbers into ranges

    Lynn, your solutions are great :-D. But this is the 7,2000 forum 🙁

    I wonder if that helps the OP.

    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: Query Result in HTML format

    Divide and Conquer.

    Divide your html into 3 parts: headers, rows and closure.

    OK, I misread. All you have to do is add an ISNULL outside the CAST.

    However, the original suggestion is...

    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: increment values on day basis on column

    Eugene Elutin (8/28/2012)


    anuj12paritosh (8/28/2012)


    HI ALL

    PLEASE PROVIDE SOME EASY WAY IF YOU KNOW

    THANKS

    The easiest way to achieve that will be switching to SQL2012 and using sequences.

    All others ways will not...

    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: Selecting records based on string search

    Too complicated. Keep it simple.

    create procedure dbo.STORED_PROC_NAME

    (

    @sstrg varchar(100)

    )

    as

    begin

    set nocount on;

    --declare @strg varchar(100) = 'Catalog',

    set @sstrg = '%' + REPLACE( @sstrg, '*', '%') + '%'

    SELECT project_name

    FROM groups

    WHERE...

    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: does not work with outer join or outer apply

    OK, so here's the dynamic query. Simple and effective. As you see, the real query is just hitting 2 tables, the Certs table is just used to create the query....

    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,521 through 8,535 (of 8,731 total)