Forum Replies Created

Viewing 15 posts - 2,146 through 2,160 (of 2,458 total)

  • RE: Combining 2 queries

    Something like this perhaps...

    -- your data

    DECLARE @Report1 TABLE (contract varchar(20), A int, E int, N int, P int);

    INSERT @Report1

    SELECT 'Income', 5000, 6000, 8000, 4000 UNION

    SELECT 'Costs', 4000, 7000,...

    "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: patindex alternative in SSIS

    If you can use CLRs you could look at mdq.regexmatches. See this thread.

    "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: Call SP foreach Column in Table (without Cursor)

    opc.three (8/19/2013)


    Here is a non-cursor option, just for the sake of having an alternative to using a cursor:

    DECLARE @sql NVARCHAR(MAX) = N'';

    SELECT @sql += 'EXEC LoadFile ' + QUOTENAME(FILENAME, '''')...

    "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: Dynamic Sorting Issue

    Thanks Luis!

    "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: Need help in query...

    -- (1) Source Data

    DECLARE @nbrs TABLE (n int primary key);

    INSERT @nbrs VALUES (10),(20),(30),(40),(50);

    -- (2) Solution

    WITH

    s1 AS (SELECT ROW_NUMBER() OVER (ORDER BY n) AS rn,n FROM @nbrs),

    s2 AS (SELECT rn-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

  • RE: Allow developers to install sql express on desktops?

    First, I second both responses to your question. I actually have a couple versions of SQL server installed on my machine: 2008R2 Developer Edition & SQL Server 2012 Express. Developer...

    "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: Problem with EXCEPT statement

    I have run into the exact same type of thing...

    /bangs head.

    This is the cause of my receding hairline. :hehe:

    "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: Problem with EXCEPT statement

    the source data is coming from a database in the UK and the values sometimes contain non alpha-numeric characters. i'm probably wrong, but i'm wondering if some of these characters...

    "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: Problem with EXCEPT statement

    Shot in the dark here but, are you using a case sensitive collation?

    "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: Case statements advice - query case field?

    learning_sql (8/13/2013)


    Ha, it literally said "Reporting Services does not support CROSS APPLY".

    However I have just been playing around and when just typing the query it worked every time, I have...

    "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: Case statements advice - query case field?

    dwain.c (8/12/2013)


    Alan.B (8/12/2013)


    Instead of the case statement you can also do this:

    SELECT ISNULL(thing1.name,(ISNULL(thing2.name,thing3.name))) AS name

    And why not:

    SELECT COALESCE(thing1.name,thing2.name,thing3.name) AS name

    ?

    Nice. That is cleaner and easier to read.

    +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

  • RE: Do I need to use cursors for this?

    First, welcome to SSC!

    If I understand your question correctly you have some VB code that accepts parameters, builds a query based on those parameters then sends that query (ad...

    "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 migration on new sql server 2008R2

    We will be planning to migrate sql 2005 and sql 2008R2 on new windows 2008R2 server, we have one Replicated DB which ones we are subscribing and we don't have...

    "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: Case statements advice - query case field?

    Instead of the case statement you can also do this:

    SELECT ISNULL(thing1.name,(ISNULL(thing2.name,thing3.name))) AS name

    "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 pre-requisties

    First, check out the Stairway to SQL Server Replication[/url] by Sebastian Meine.

    I am going to set up replication in an OTLP environment. I would like to know what as...

    "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,146 through 2,160 (of 2,458 total)