Forum Replies Created

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

  • 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".

  • RE: How to divide number

    If the original amount is odd, add 1 cent to the first joint account holder. That will work regardless of the number of joint account holders:

    select cast(original_amount/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: need help on design of database for student registration system

    The core thing is not to skimp on the design. It may look 'leaner' to just leave out some relationship tables, or to combine some relationship tables, but doing...

    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 write query to count and group by different value based on a field

    halifaxdal (2/21/2014)


    ScottPletcher (2/21/2014)


    I, too, got different totals; mine add up to 82, the number of sample rows of data.

    SELECT

    Owner, CAST(YEAR(Quarter) AS char(4)) + 'Q' + CAST(DATENAME(QUARTER,...

    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 write query to count and group by different value based on a field

    I, too, got different totals; mine add up to 82, the number of sample rows of data.

    SELECT

    Owner, CAST(YEAR(Quarter) AS char(4)) + 'Q' + CAST(DATENAME(QUARTER, Quarter) AS...

    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: Need help with this query

    Maybe this?!:

    SELECT

    t1.DOCUMENT_NO,

    RTRIM(CAST(t1."ENVIRONMENT_CD" AS VARCHAR(5))) + '*' + RTRIM(CAST(t1."ORDER_NO" AS VARCHAR(25)))

    + CASE WHEN TEST_REPORTING_MATERIAL_SID__COUNT > 1 THEN...

    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: Need help with this query

    The "ON" clause after the "FROM" is not valid. That condition should just be in the WHERE conditions, since it's a correlated condition.

    I don't know about Netezza, but 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".

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