Forum Replies Created

Viewing 15 posts - 2,191 through 2,205 (of 2,462 total)

  • RE: Can I join on an alias?

    You can. It's hard to work with what you posted so I created the following sample code to demonstrate how you would join two tables in the way you are...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: delete top 100

    As Sean said, you need an ORDER BY statement.

    I created some sample data and a query that you could use for reference. I am a fan of using the...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Index and Table Size

    My object naming needs to be cleaned up a little but I think you are looking for something like this:

    IF OBJECT_ID('tempdb..#tableDataPrep') IS NOT NULL

    DROP TABLE #tableDataPrep;

    IF OBJECT_ID('tempdb..#tableData') IS NOT NULL

    DROP...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: capture currently logged in users from sql

    You can do something like what I did below. I'm not 100% clear about what you are trying to do but this should help....

    You would have an agent job run...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Finding Missing values

    thomashohner (7/16/2013)


    Micky you are one awsome dude! Worked like a charm:w00t: I had to get this list the old fashion way by hand comparing lists in excel and then...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Finding Missing values

    First, welcome to the SSC forums. This is a great place to get help and for someone looking to grow their SQL skills.

    Note the link in my signature line for...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Query The start up type of a service

    Here's how you can do it without PowerShell. Note that, in the code below, I am only getting the information for the SQL Service Account. The steps will be similar...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Help needed for Select Query

    No problem.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: stored procedure keeps spinning

    I would start here: http://www.sqlservercentral.com/articles/SQLServerCentral/66909/%5B/url%5D

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Updating SQL table using SSRS

    ARGH!!!! I just attempted to post a detailed response, got an error and lost what I wrote. Forgive any errors and typos:

    First, SSRS is not designed for this kind of...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Replication DB - Dead lock issue

    The best way to resolve deadlocks is adding the trace flag as Wolfgang mentioned. That said, when you are dealing with Replication I strongly suggest you become familiar with the...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: which version sp should i install on my SQL Server 2008 r2 (RTM); 64 bit.

    It's best to have the most current Service pack; Service Pack 2 is the most recent service pack for SQL Server 2008 R2.

    See this article for more details.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Error when trying to compress the backup

    Barcelona10 (7/9/2013)


    It is available.Trust me

    Compression is available, my bad. I did not see that you were on 2008 R2.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Error when trying to compress the backup

    You are using Standard Edition. I don't believe that Compression is available in Standard Edition.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Parsing the XML

    Here's the code to turn the XML code in #2 into a table...

    DECLARE @Pt TABLE (x XML not null);

    INSERT INTO @Pt

    SELECT '<Movie><MovieName>ABCD</MovieName><Genre>Horror</Genre></Movie>

    <Movie><MovieName>EFGH</MovieName><Genre>Sci-Fi</Genre></Movie>

    <Movie><MovieName>IJKL</MovieName><Genre>Comedy</Genre></Movie>';

    SELECT m.value('(MovieName/text())[1]', 'varchar(20)') AS Movie,

    m.value('(Genre/text())[1]',...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 15 posts - 2,191 through 2,205 (of 2,462 total)