Forum Replies Created

Viewing 15 posts - 4,216 through 4,230 (of 7,613 total)

  • RE: Need query for After Trigger on update,delete

    Jeff Moden (8/15/2016)


    Also, you should probably avoid auditing inserts. It's an unnecessary duplication of data because even if there's never an update, the original data lives in the original...

    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: Additional table in statement with OUTER APPLY

    I don't see any reason to conflate the last run with the next run. Also, when you query job activity, you need to include the session_id to make sure...

    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: explain composite index structure and work? How B Tree for composite index work internally?

    koteravindra (8/8/2016)


    HI,

    suppose if I have 3 columns in index with index order as ASC .

    Emplid,deptid,Accountid

    10 2 ...

    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: joining multiple tables without a join

    skippyV (8/5/2016)

    All these fields are nvarchar(50).

    So they're not nvarchar(50) but nvarchar(max)? Yeah, that's a totally different thing. Again, can't imagine why you'd ever need unicode there, let alone "max"!!

    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: Varchar to money\decimal

    Since you don't have quotes around the assigned value, the +000000007000 is first being converted to an int value, and then that value is converted to varchar(10). Naturally your actual...

    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: joining multiple tables without a join

    Again, there should be no issue at all indexing on an nvarchar column (although I can't imagine why you'd actually need unicode for that type of data).

    Can you post 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: Varchar to money\decimal

    There are no decimal places in the value: SQL can't possibly know to "adjust" for 2 decimal places from a varchar value. Therefore, if you need such an adjustment, make...

    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: joining multiple tables without a join

    skippyV (8/5/2016)


    ScottPletcher (8/4/2016)


    Given that there is no clustered index now, you might as well clus to match this query, something like below. If you have DATA_COMPRESSION available, be sure...

    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: remove duplicate values in a view , without affecting main tables

    Probably this (?):

    SELECT d1.StudentID, d1.VehicleID, d1.VehicleType

    FROM (

    SELECT *, ROW_NUMBER() OVER(PARTITION BY StudentID, VehicleID

    ORDER BY CASE WHEN VehicleType...

    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: remove duplicate values in a view , without affecting main tables

    Here's a quick example of what Drew's talking about. Naturally adjust the ORDER BY clause as needed to get exactly the output you want:

    IF OBJECT_ID('tempdb.dbo.#StudentTransportOrder') IS NOT NULL

    ...

    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: joining multiple tables without a join

    Given that there is no clustered index now, you might as well clus to match this query, something like below. If you have DATA_COMPRESSION available, be sure to 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: help needed with sql update

    I think CROSS APPLY (or OUTER APPLY if you want NULL if no match is found) will do it, but of course I can't test it without useable data.

    Btw, 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: Proper Storage and Handling of Personal Names

    Robert Domitz (8/4/2016)

    3. Is "von Helsing" the same as "VONHELSING" or just "HELSING"? In the latter case, the originating system sliced off the "von" as a middle name!

    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: Proper Storage and Handling of Personal Names

    You certainly don't want to just store the entire name in one long, indistinguishable string. Trying to accurately parse that out later is virtually impossible.

    As to the different rules/formats,...

    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 make optimizer choose an Index Seek when I have ISNULL() FUNCTION on my column referenced in WHERE condition?

    1) Don't use ISNULL, you don't need it there anyway:

    select c1,c2,c3 From numbers

    where c3 <> 'CP-961080'

    2) A nonclustered index lookup would be very inefficient here, although you might be able...

    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,216 through 4,230 (of 7,613 total)