Forum Replies Created

Viewing 15 posts - 7,291 through 7,305 (of 8,731 total)

  • RE: Stored procedure taking too long to run

    You don't need to go through each store with a while loop. You can remove all duplicates at a time. There are several ways to do this and the best...

    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: Unable to convert character to datetime

    There's no need to do a previous conversion to datetime if this is a one time extraction as SQL Server will do an implicit conversion.

    WITH SampleData AS(

    SELECT CAST( '2013-12-30 12:09:00.123'...

    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: Pivots

    You're welcome.

    Do you understand why did it work? You need to understand it to make any further modifications.

    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: Memories of 2013

    OCTom (12/29/2013)


    I was thinking hard about a SQL memory from 2013 that was worthy of mention. I had that happen Friday night. I have been tutoring a 10 yr old...

    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 that will pass multiple parameters to one or many other stored procs

    The easiest way would be to do as you say, I'm not sure if there's some way around.

    CREATE PROCEDURE CallingProcedure

    (

    @StartDate date,

    @EndDate date,

    ...

    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: Help with getting a Table Count across multiple DBs

    Here's a code to show you how can it be done. You might need to fix it.

    DECLARE @dbname sysname

    CREATE TABLE #counts( totalcounts int)

    DECLARE DBs CURSOR FOR

    SELECT name

    FROM sys.databases

    WHERE database_id >...

    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: records in table A not present in table B

    happy55 (12/27/2013)


    Yes I had a where clause for table B.I removed it as per your suggestions and it works:-)

    Thanks for your help

    I've seen it a lot of times and it...

    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: Pivots

    If you have problems with pivot, you should try the method I posted earlier. It's even better when you need to pivot several columns. You'll find information in the link...

    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: records in table A not present in table B

    Do you have a WHERE clause in your query using a column from table B?

    That might be the issue. If you do, change it to the JOIN clause.

    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: Pivots

    You didn't need to open a new thread. You could just post this on the previous one.

    Here's an example, but don't blame me if it doesn't work as you want...

    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: Pivot issues

    I'm helping here for free.

    If you want simple examples, you can press F1 and find examples on PIVOT. Or you can click on the "useless" link I provided 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: Pivot issues

    You could read this article to find out how to work with CROSS TABS.

    http://www.sqlservercentral.com/articles/T-SQL/63681/

    For a coded answer, please read the article linked in my signature to now what we need...

    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: can this be pivoted?

    You're welcome.

    But, do you understand how it works?

    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: can this be pivoted?

    What you're trying to do is explained on this article. http://www.sqlservercentral.com/articles/comma+separated+list/71700/

    Read it and check the solution.

    SELECT customer_id,

    all_emails = STUFF((SELECT ' -- ' + email_text

    FROM emails x

    WHERE x.customer_id = e.customer_id

    FOR XML...

    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: Improve SIMPLE SELECT to retun 2 LAC Rows faster?

    vladisaev@hotmail.com (12/26/2013)


    Without looking at details/specifics,

    you can try to get a 'blind' performance gain by using @Table table type variable instead of

    #temporary table. You can gain performance improvement...

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