Forum Replies Created

Viewing 15 posts - 4,576 through 4,590 (of 7,619 total)

  • RE: How to catch actual parameter value passed into a stored procedure?

    If it's for a single, specific stored proc, could you just add code to that proc to save the parameter values that came in? You could even have an...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: How to select 200k data faster in sql

    Do you have a unique index on Word? You don't want SQL to have to sort the words every time -- that will be extremely slow. Also, if...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: indexing Datetime column

    The clustered index is definitely correct. Date will be mildly more efficient than datetime, but it's not enough of a difference to be a big deal.

    Make sure the fillfactor...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: SELECT 1 random row query help, please

    kiril.lazarov.77 (12/10/2015)


    ScottPletcher (12/9/2015)


    Create a separate index of just the IDs. Then select a random ID using ORDER BY NEWID(), then use that ID to get the rest of the...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: SELECT 1 random row query help, please

    kiril.lazarov.77 (12/10/2015)


    ScottPletcher (12/9/2015)


    Create a separate index of just the IDs. Then select a random ID using ORDER BY NEWID(), then use that ID to get the rest of the...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: how extract values from expressions

    If it's always a "w" followed by a digit or digits, perhaps just this?!:

    declare @testdata table(expression varchar(500))

    insert into @testdata values('[w1+w2+w3/5]'),('[(w1+w2+w3)/5]'),('[(w4-w5*w6)/5]')

    insert into @testdata values('w1')

    insert into @testdata values('2w3')

    insert into @testdata values('4+w5')

    select 'w'...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: How to update rows faster

    Cluster the table on the month.

    I'd include at least the year with the month. Best is to use a column of type date, but if necessary you can use...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: working with Case inside a IF EXISTS

    No, the syntax is somewhat off. A CASE expression must evaluate to a single value.

    For what you're doing, try something like this instead:

    IF @Client = 'Winco Foods' AND EXISTS(

    SELECT...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Dynamic filtering of concatenated fields

    Also, for best performance, specify the least likely to match condition first. If one (or more) of the AND conditions are going to be false, you want SQL to...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: SELECT 1 random row query help, please

    Create a separate index of just the IDs. Then select a random ID using ORDER BY NEWID(), then use that ID to get the rest of the columns. ...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Dynamic filtering of concatenated fields

    Do you want the concatenation to be able to cause a match? For example, if the PartnerName ends in "f", and the Address begins with "arm", should that cause...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: UNION Query with Filtered Results

    If the tables are indexed on id, you just have to force SQL to use the obvious MERGE join it should have been using anyway(!) 😀 :

    DROP TABLE #TABLE1

    DROP TABLE...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: UNION Query with Filtered Results

    Sean Lange (12/8/2015)


    ScottPletcher (12/7/2015)


    In this case, there's no real need for CTEs or UNIONs either, just standard FULL joins:

    SELECT

    COALESCE(t1.PRODUCTID, t2.PRODUCTID, t3.PRODUCTID) AS PRODUCTID,

    ...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Would like a LOGON Trigger to record when it rolls back a logon attempt

    An INSERT to a table won't try to return a result set ... unless you're missing a:

    SET NOCOUNT ON

    at the start of the trigger. Verify that statement is present.

    Edit:...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: UNION Query with Filtered Results

    In this case, there's no real need for CTEs or UNIONs either, just standard FULL joins:

    SELECT

    COALESCE(t1.PRODUCTID, t2.PRODUCTID, t3.PRODUCTID) AS PRODUCTID,

    COALESCE(t3.STATUS,...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

Viewing 15 posts - 4,576 through 4,590 (of 7,619 total)