Forum Replies Created

Viewing 15 posts - 901 through 915 (of 1,228 total)

  • RE: SET ROWCOUNT

    This...

    SET ROWCOUNT 2;

    INSERT INTO #Test_Rowcount (Value)

    SELECT TOP 4 * FROM (

    SELECT 'One' V UNION ALL ...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Update table with values from the same table

    Hi Martin, sorry for not making it sufficiently clear. What I'm after is data in both tables, and your query, to replicate your findings. So...

    INSERT INTO Company ([columnlist]) VALUES ([Valuelist])

    INSERT...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Diagonal matching of data (wanted vlookup like concept in sql)

    -- Correct result, dodgy logic

    (SELECT *

    FROM #TABLE1

    EXCEPT

    SELECT * FROM #TABLE2)

    UNION ALL

    (SELECT *

    FROM #TABLE2

    EXCEPT

    SELECT * FROM #TABLE1)

    -- correct result, correct logic

    SELECT t1.*

    FROM #TABLE1 t1

    WHERE EXISTS (

    SELECT 1...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Opinion on working for small company, directly for owner(s)

    Dorian Gray (4/21/2011)


    I'm still stuck on "higher steaks" - would that be rare, medium or well done?! :hehe:

    ps: Sorry - couldn't resist. I'd say go with your gut instinct. Typically...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Opinion on working for small company, directly for owner(s)

    You will get a wide range of responses from folks who've been in this position. Here's my experience, from being there twice in 20 years of contracting.

    If you don't mind...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Can I add extra columns to CTEs

    v-anand (4/21/2011)


    Hello all,

    I need to create a temporary table so as to do some calculation.

    For example there is a table named Product having columns -ProductID, ProductName, Price and there is...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Update table with values from the same table

    Also, INSERT statements to create data in both tables which will generate this result:

    CompanyName StreetNumber StreeName StreetType Suburb Postcode State

    123 Acc Brisbane 4000 QLD

    123 Acc 123 Pitt Street Brisbane 4000...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: procedure not define - Begin Trans and commit trans (urgent)

    ananda.murugesan (4/21/2011)


    Hi ChrisM,

    In SQL SERVER 2000.

    Blocked process not clear after restarting SQL SERVICES, please tell me what could be reason? once restart the service all transaction will be terminated...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Sql doubt

    Dynamic SQL isn't necessary:

    ALTER PROCEDURE dbo.MyTest

    AS

    SELECT TOP 10 [name] FROM sys.columns ORDER BY [name]

    RETURN 0

    GO

    CREATE TABLE #ColumnNames ([name] VARCHAR(200))

    INSERT INTO #ColumnNames ([name]) EXEC dbo.MyTest

    SELECT * FROM #ColumnNames


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: TSQL Logic help needed-- Nested IF

    David Burrows (4/21/2011)


    Jeff Moden (4/20/2011)


    If we don't know the length, then we can force the max length for positive BIGINTs and simply remove all spaces afterwards.

    Also if you append the...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: procedure not define - Begin Trans and commit trans (urgent)

    Hi Ananda

    Your first point - rewriting the code - if the code you posted is a representative sample then I'd agree. Find the worst-performing code and begin there. Grant Fritchey...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: procedure not define - Begin Trans and commit trans (urgent)

    Hi Ananda

    Let's have a closer look at that stored procedure. It's a series of DELETE/INSERT statements separated by conditionals - depending on what's already in the db, one of them...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Update table with values from the same table

    Hi Martin

    Please can you post CREATE TABLE statements for both tables. Some sample data for each would be awesome. Also, the simple query which returns:

    CompanyName, StreetNumber, StreeName, StreetType, Suburb, Postcode,...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Return 0 From Function

    Michael Valentine Jones (4/20/2011)


    ChrisM@home (4/20/2011)

    ...

    @michael-2 - I can't believe you posted that!

    I'm just hoping to see someone use it in production code. :satisfied:

    Actually, I started wondering if a function...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Return 0 From Function

    david.holley (4/20/2011)


    So check to see if the returned value is null and if it is return the lower boundary date?

    Exactly. Your app will have to check the value is or...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

Viewing 15 posts - 901 through 915 (of 1,228 total)