Forum Replies Created

Viewing 15 posts - 6,586 through 6,600 (of 7,613 total)

  • RE: Convert IP address to Binary (32)

    Here's T-SQL code to generate the full @decode_string:

    DECLARE @decode_string char(2055)

    ;WITH

    cteDigits AS (

    SELECT 0 AS digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL 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: Convert IP address to Binary (32)

    The @decode_string needs a slight adjustment, moving the decode value for "255" to the end of the string.

    As there's really no need to recompute the string every time, let's just...

    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: Convert IP address to Binary (32)

    I don't think it's really that complex.

    I suggest a single lookup/"decode" string, with eight bytes per ip code; I'd also use a leading 7 "filler" 🙂 bytes, just to 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: Rounding up

    dr.mannhattan (4/9/2013)


    ROUND(ISNULL ((SL2.Importe - SL2.Propina - SL2.ScAmt) -((SL2.Importe - SL2.Propina - SL2.ScAmt)/ 1.16),0), 2, 1) As ImpIVA, --the final ", 1" on the ROUND function "tells" it to truncate,...

    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: Rounding up

    SQL will automatically cast the result to the receiving data type; cast will automatically round.

    To prevent rounding, you can explicitly use the ROUND function yourself (kinda ironic):

    ROUND(ISNULL ((SL2.Importe - SL2.Propina...

    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: Dead Lock Question

    Turn on trace flag 1222:

    DBCC TRACEON ( 1222, -1 )

    Then when a deadlock occurs, SQL will put detailed info about the deadlock into the SQL error log.

    Rebooting will not help...

    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: Another Conversion Question of Text to Date

    rarascon (4/9/2013)


    One more thing, I did wind up having to add a new column, because as Sean mentioned the original column as varchar is always going to be a thorn...

    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: Another Conversion Question of Text to Date

    STUFF(TheDate, 3, 0, '/01')

    Would convert 'mm/yyyy' to 'mm/01/yyyy'. You could then use it as a date, either implicitly (somewhat risky) or explicitly, 100% safe but you have 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: Need Minimally Logged Operation to Cause Checkpoint!

    GilaMonster (4/5/2013)

    Any data modification that is minimally logged has to be written to the data file before the transaction completes

    I don't think that's true. If it is, it violates...

    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 delete my temp tables in batch?

    In SQL Server, temporary tables start with # or ##, such as #table or ##table.

    IIRC:

    SQL will automatically destroy # tables when the connection ends.

    For ## tables, under SQL 2005 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: How to preserve global temporary table data

    Lynn Pettis (4/4/2013)


    ScottPletcher (4/4/2013)


    Lynn Pettis (4/4/2013)


    Not saying I am right or wrong. I wanted a straight answer to a straight question: Is it a problem to lose the data...

    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 preserve global temporary table data

    Lynn Pettis (4/4/2013)


    Not saying I am right or wrong. I wanted a straight answer to a straight question: Is it a problem to lose the data if there is...

    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 preserve global temporary table data

    Lynn Pettis (4/4/2013)


    ScottPletcher (4/4/2013)


    Lynn Pettis (4/4/2013)


    ScottPletcher (4/4/2013)


    You're vastly more likely to lose a single connection than have the entire instance go down, which would kill a temp table from that...

    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 preserve global temporary table data

    Lynn Pettis (4/4/2013)


    ScottPletcher (4/4/2013)


    You're vastly more likely to lose a single connection than have the entire instance go down, which would kill a temp table from that connection as well.

    I...

    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 me tune this query...Please. :)

    Agree absolutely. Can you not specify any time of date range to help limit the rows to be processed?

    And, what the heck, maybe try this first too:

    SELECT CASE WHEN...

    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,586 through 6,600 (of 7,613 total)