Forum Replies Created

Viewing 15 posts - 5,011 through 5,025 (of 7,615 total)

  • RE: need help on Scalar value Function

    sgmunson (6/25/2015)


    ScottPletcher (6/25/2015)


    GilaMonster (6/25/2015)


    Nolock hints, do you know what they do? (hint, they don't make queries faster)

    Why does everyone keep repeating that? Of course NOLOCK hints make queries run...

  • RE: query about nulls

    sgmunson (6/25/2015)


    ScottPletcher (6/25/2015)


    I prefer this approach [Edit: Because of its clarity, and to avoid using functions in the WHERE clause, which should be avoided whenever (reasonably) possible]:

    WHERE

    ...

  • RE: query about nulls

    I prefer this approach [Edit: Because of its clarity, and to avoid using functions in the WHERE clause, which should be avoided whenever (reasonably) possible]:

    WHERE

    (requirementGradYear...

  • RE: need help on Scalar value Function

    GilaMonster (6/25/2015)


    Nolock hints, do you know what they do? (hint, they don't make queries faster)

    Why does everyone keep repeating that? Of course NOLOCK hints make queries run faster, even...

  • RE: Create table help?

    Select [C1] ,

    [C2] ,

    DATEADD(S, C3, '1970-01-01 00:00:00') AS [C3] ,

    [C4] ,

    [C5] ,

    [C6] ,

    [C7] ,

    [C8] ,

    [C112],

    [C675001003] ,

    [C812000101] ,

    [C875000000] ,

    [C875000001],

    [C875000002] ,

    [C875000003] ,

    [C875000004] ,

    [C875156000] ,

    [C875156001] ,

    [C875156002] ,

    [C875156005] ,

    [C875156006] ,

    [C875156007] ,

    [C875156003] ,

    [C875156004]...

  • RE: Working around the lack of subquery support

    drew.allen (6/19/2015)


    By default, SQL Server joins tables in left-to-right order,

    I'm not sure it's safe to make that blanket statement. I think SQL will join in whatever order it deems...

  • RE: Unable to run procedures with 'Execute as owner'

    Is the owning account a single user account? Or did it get changed into a group account or role?

    When you use "EXECUTE AS OWNER" the owner cannot be a...

  • RE: Update or something else

    UPDATE Sales

    SET Sales.price = P.price

    FROM Sales

    CROSS APPLY (

    SELECT TOP (1) price

    FROM Price

    WHERE Sales.itemId = Price.itemId AND

    ...

  • RE: Trigger for Update action without primary key

    That trigger is way too much overhead. The trigger itself cannot be dynamic. Instead, dynamic code should be used to generate a static trigger, which will need regenerated...

  • RE: CTE (?) or query help

    I created minimum sample data, which I've included after the main code. I assumed you have a table that has a list of IDs -- if not, just uncomment...

  • RE: Cannot perform an aggregate function on an expression containing an aggregate or a subquery

    Please try this and see if it's right, or at least very close :-D. Btw, please add appropriate table aliases to all columns (scope_id, firstName (presumably CUS but not...

  • RE: Running DBCC CHECKIDENT ('shema.table', RESEED, 0) from a Stored Proc?

    With this method, the web login/user can use only procs that you're explicitly given the web app authority to execute. I don't know how to lessen the risk. ...

  • RE: Running DBCC CHECKIDENT ('shema.table', RESEED, 0) from a Stored Proc?

    You could try this:

    1) create a separate "power user" that has ddladmin authority in that db

    2) create a stored proc that runs under the power user account (EXEC AS 'power_user')...

  • RE: scalar function returning zero when it shouldn't

    For best performance, get rid of all unnecessary variables in functions.

    Edit: Changed COUNT to COUNT_BIG based on return data type.

    CREATE FUNCTION dbo.spGet_Rec_Count

    (

    @source_tbl varchar(100)

    )

    RETURNS bigint

    AS

    BEGIN

    RETURN (

    ...

  • RE: WHERE Clause, Indexes and and Calculations

    I'd put it all in the JOIN clause, since that's what those conditions effectively are:

    DELETE x

    FROM TableX x

    INNER JOIN TableY y ON (x.Id = y.Id) AND

    ...

Viewing 15 posts - 5,011 through 5,025 (of 7,615 total)