Forum Replies Created

Viewing 15 posts - 1 through 15 (of 275 total)

  • RE: Find Similar rows and add totals together.

    Thanks for the explanation, that makes sense.

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: Find Similar rows and add totals together.

    I thought E was an id value and thus unique. Maybe I'm wrong there.

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: Find Similar rows and add totals together.

    Barring some type of "fuzzy" update, the fastest way is probably to save your results as a temporary table, then use that table to UPDATE the original data and DELETE...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: Find Similar rows and add totals together.

    Is this a homework q?

    Look at GROUP BY clause ... it will provide what you need.

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: SQLSERVER TRiggers

    Of course if column1 and/or column2 are not char data types, you will need to change 'zzz' to something that matches their data type(s).

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: SQLSERVER TRiggers

    Not a big deal. You can handle everything easily in a trigger:

    CREATE TRIGGER trigger_name

    ON table_name

    AFTER UPDATE

    AS

    --if no rows were actually UPDATEd, exit immediately

    IF @@ROWCOUNT = 0

    ...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: ODD SQL Behavior

    Note that you could have a script that:

    1) created stored procs that did the update(s)

    2) main code that ran or not ran each stored proc as needed based on column(s)...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: ODD SQL Behavior

    SQL compiles in batches. A "GO" statement will start a different batch. Sometimes you can use that to work around column-exists-or-not issues.

    You can also use a stored proc...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: How to create procedure from definition of another procedure

    Actually, I think the original q dealt with duplicating the stored proc code. For that, I still think OBJECT_DEFINITION works much better than sp_helptext.

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: How to create procedure from definition of another procedure

    Since OBJECT_DEFINITION returns an NVARCHAR(MAX), I would expect it to be able to return up to 2G - 1 (or roughly 1 billion visible characters).

    I've never had any issue with...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: get the name of the bit column set to 1

    Michael and Lowell nailed it, that's what you need to do.

    You might want to consider adding that as a computed column to the table, rather than doing it in the...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: How to create procedure from definition of another procedure

    I'd suggest using OBJECT_DEFINITION rather than the other methods mentioned.

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: How many ways to measure selectivity?

    I don't think so, unless you have extremely unselective data.

    Being the clustered index, SQL can always do a seek if you provide a specific key value(s) or range.

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: How many ways to measure selectivity?

    This is mainly relevant to non-clustered indexes, of course. ]If you specify the first column on a clus index, naturally it does not need to be selective to use...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: how many variables can I have?

    Having a variable table would be lot more overhead too. I don't see any real gain from it.

    If you need ~2K variables, you need them, just go ahead and...

    Scott Pletcher, SQL Server MVP 2008-2010

Viewing 15 posts - 1 through 15 (of 275 total)