Forum Replies Created

Viewing 15 posts - 6,211 through 6,225 (of 7,619 total)

  • RE: Custom sort order within each group of the result set

    RexHelios (3/20/2014)


    Scott,

    I think we have a slight disconnect here :). Your query is selecting from @ItemListOutput, which is where I included "ItemSortOrder" column. I did this to show my desired...

    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: Custom sort order within each group of the result set

    RexHelios (3/20/2014)


    Scott,

    Thanks for your suggestion, but your query won't give me the sort order id for each individual item of an order. Please look at the last column of @ItemListOutput...

    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: Checking varchar data to see if it can be cast as decimal

    Luis Cazares (3/19/2014)


    You could try something like this:

    WHERE somecolumn NOT LIKE '%[^0-9.]%'

    This won't be completely safe as it will return false positives for values with more than one point(.).

    WHERE

    ...

    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: EXCEL-SQLServer - Is is possible to force isolation level read uncommited for specific logins ?

    I think the best try might be to use a LOGON trigger. Hopefully you can identify those Excel logins using APP_NAME() and/or HOST_NAME() and/or ORIGINAL_LOGIN() (and/or whatever else).

    Within 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: Custom sort order within each group of the result set

    I don't think you have to go thru all that.

    SELECT *

    FROM @ItemListOutput

    ORDER BY

    OrderID,

    CASE WHEN ItemTypeID = '4006' THEN 1 ELSE 2 END,

    ...

    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: Changing Max memory setting to take effect - SQL restart required?

    NO, you do not.

    You must at least RECONFIGURE, and maybe RECONFIGURE WITH OVERRIDE, so just use the latter, as that will cover all cases.

    Note that it may take SQL a...

    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: Transactions

    I prefer using XACT_STATE() rather than @@TRANCOUNT, as it indicates when you must use ROLLBACK rather than COMMIT.

    Edit: Of course XACT_STATE() can't tell you whether you have nested trans, but...

    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: Exclusion Syntax Help

    I think you were very close:

    where

    (slord <> 249486 or slline not in (1,3,5))

    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: get the first date and weekday of every month in a year

    Lynn Pettis (3/14/2014)


    vamsikrishnacheruku (3/10/2014)


    hai i want to get the first date and weekday of every month in a year .

    1/jan/2014, monday

    1/feb/2014,thrusday

    ...

    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: get the first date and weekday of every month in a year

    Not a big deal in this case, but I don't like generating hundreds of values when I need only 12 :-). I think code below does less work and...

    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: Identifying Current Record

    rka (3/6/2014)


    But what is the best way to detect the old records. I believe I still have to go through all the records via Snapshot_Date. Still can't figure out 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: Database Triggers to prevent large DDL transactions

    You'd have to use an INSTEAD OF trigger, naturally. Those are a pain to write and maintain, since you must write code yourself to complete the modification -- DELETE...

    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: Is cascade delete Slow

    Yes, the logging especially will be take a lot of time.

    But, it will be much more bearable if:

    1) the child tables are clustered properly (as usual!), i.e., starting with...

    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: Identifying Current Record

    I'd definitely add a bit column to the table. Your data and your statements seem contradictory, but I think when a new row is added that becomes current, you...

    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: Catch Block with GOTO statement

    MyDoggieJessie (3/6/2014)


    This should work for you (create a variable and set the @@ERROR to it, then test for it before you attempt the xp_cmdshell)DECLARE @Err INT

    BEGIN TRY

    BEGIN TRANSACTION

    <A whole bunch...

    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 - 6,211 through 6,225 (of 7,619 total)