Forum Replies Created

Viewing 15 posts - 8,566 through 8,580 (of 8,731 total)

  • RE: Update table based on column grouping

    You're welcome.

    Be sure to understand the code before you use 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: Update table based on column grouping

    Here's one option

    UPDATE o SET

    phonecount = g.phonecount,

    contactnamecount = g.contactnamecount

    FROM @PhoneTable_New o

    JOIN (

    SELECTMAX(ID) max_id,

    phone,

    COUNT(phone) phonecount,

    COUNT( DISTINCT contactname) contactnamecount

    FROM @PhoneTable_New

    GROUP BY phone ) g ON o.phone = g.phone AND o.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: evaluating and combining values from two rows

    From what I remember from your query, it was working ok if you made the corrections I told you.

    If you want to obtain the total devaluation value, you should not...

    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: need help replacing cursor logic in stored procedure w/faster sql statement

    This could work, but I don't have sample data to test with. I'm not sure about performance but it's 2000 friendly 😛

    INSERT INTO XX_ordid_tracker (

    poid,

    recptkey,

    ord_id)

    SELECT r.ord_oda_id,

    r.token,

    ISNULL(...

    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: CONVERT DATA COLUMN TO ROW WTIH COMMA

    Something like this?

    DECLARE @test-2 table(

    col1int)

    INSERT INTO @test-2

    SELECT 1 UNION ALL SELECT

    2 UNION ALL SELECT

    3 UNION ALL SELECT

    4 UNION ALL SELECT

    5 UNION ALL SELECT

    6...

    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: String concatenation

    This thread can help you.

    http://www.sqlservercentral.com/Forums/Topic1335869-391-1.aspx

    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: Basic of T-SQL

    Toreador (8/20/2012)


    Currently 15% of people think that Count(columnname) on a 7-row table will return a value of 10 😉

    When I read that answer, for a moment I thought it could...

    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: Transaction Log drive in simple recovery

    Thank you very much for your answers.

    I'm new at administration and I guess I'll have to do some research on RAID and other parts referring to infrastructure of SQL...

    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: evaluating and combining values from two rows

    Mr. Celko,

    The main problem in here wouldn't be the DDL as we cannot see the original table just a simplified version of it. I'm pretty sure the OP shouldn't be...

    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: Create Trigger within StoredProc

    No one said they were working on a production database.

    I believe that most problems like this should be solved with other administration options and not triggers. I wouldn't say you...

    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: Create Trigger within StoredProc

    Sean Lange (8/17/2012)


    Why do you have users that are not competent with sql that have SSMS installed on their desktops? If they can't be trusted with SSMS get it off...

    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: Create Trigger within StoredProc

    Did you read the links I posted? (Application Roles, EXECUTE and sp_executesql)

    My suggestion is to use the Application Roles and remove permissions to the logins.

    However, If you want to create...

    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: evaluating and combining values from two rows

    Is a good thing that you posted DDL, sample data and expected results.

    But the problem is it's not matching with each other.

    You might want to check your definition on...

    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: Create Trigger within StoredProc

    Why would you like a Stored Procedure? If this is for administration, you should do this task once.

    I'm not sure if this is the best solution, you should try 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: How to get last 5weeks of data from currentdate

    You're welcome, just be sure to know what it is doing before you use it for production (as you should always do). And be sure you can explain 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

Viewing 15 posts - 8,566 through 8,580 (of 8,731 total)