Forum Replies Created

Viewing 15 posts - 7,216 through 7,230 (of 8,731 total)

  • RE: Slow running query

    This should help you to post the information needed.

    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

    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: Trim spaces after excel import

    That's because your column Code is larger than your column Csimplecode.

    If you provide DDL of your table, I could give you the exact code, but you basically need to...

    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: Trim spaces after excel import

    You might need to do an update on all fields.

    Something like this:

    UPDATE MyTable

    SET column1 = LTRIM(column1),

    column2 = LTRIM(column2),

    column3 = LTRIM(column3),

    --...

    ...

    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: Incluse Saturday and Sunday in calculation

    I'm thinking that you might want to include "business hours" on weekends. The easiest way to do it would be using DATEPART. However, you might encounter with the problem of...

    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: Incluse Saturday and Sunday in calculation

    Your code doesn't seem to exclude weekends, it only excludes hours. Since hours can happen in any given day, you're excluding those hours on weekends as well.

    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 in where clause

    Technically, it's a single query and there's no IF..ELSE. 😀

    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 in where clause

    That's an ugly db design.

    Here's a possible solution.

    DECLARE @idEmployee int = 3

    SELECT TOP 1 MyAddress

    FROM(

    select 1 Priority, MyAddress

    from #Address a

    WHERE EXISTS( SELECT 1 FROM #Emp e

    WHERE a.idCompany =...

    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: set default parameter for function parameter

    I can't find the reference (so I might be wrong), but I'm sure you can't assign values from a function when declaring parameter defaults.

    EDIT: Reference seems to be only for...

    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: DIFFERENCE BETWEEN NOLOCK VS WITH(NOLOCK) IN SQL SERVER 2008

    Sean Lange (1/13/2014)


    I will ignore your comment about suggesting that always using NOLOCK is a good idea when integrity of the results is not important. :w00t:

    I'm sure he meant that...

    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: Full Outer Join

    What about giving us the complete scenario? You say this is a result of a FULL JOIN, but you might not need it if it's a self join.

    Please post sample...

    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: Problem with SQL Query

    If you haven't changed the query, then the data might have changed. Verify that as you might be in trouble.

    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: Group Ranges First and Last values

    I'm glad I could help even if it wasn't a complete solution for you, but at least you got an idea that worked for you. And it's even better that...

    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: Problem with self join

    Is there any reason to use a JOIN when CROSS TABS will work fine?

    SELECT Item,

    MAX( CASE WHEN Category = 'Small' THEN Value END) ,

    MAX( CASE WHEN Category = 'Large' THEN...

    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: Data from Previous Row_2

    Do you have continuous dates? Or you might have gaps?

    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: Group Ranges First and Last values

    Here's a possible solution, but I don't know if it's the best.

    WITH cteLots AS(

    SELECT *,

    ROW_NUMBER() OVER( ORDER BY lot_nbr) rn,

    ROW_NUMBER() OVER( PARTITION BY lot_OwnerID ORDER BY lot_nbr, lot_nbrDec)...

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