Forum Replies Created

Viewing 15 posts - 2,611 through 2,625 (of 7,619 total)

  • Reply To: SQL Cursor Trouble

    Jeff Moden wrote:

    Also, considering that VALUES didn't actually come out until 2008, your lecture about getting rid of the old syntax "decades" ago is full of hooie.  As for someones 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".

  • Reply To: SQL Cursor Trouble

    DROP TABLE #sampledata 
    GO

    CREATE TABLE #sampledata
    (
    id int IDENTITY(1, 1) NOT NULL PRIMARY KEY, --<<--!!
    folder varchar(100) NULL,
    folder2 varchar(100) NULL
    )
    GO
    INSERT INTO #sampledata VALUES
    ...

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

  • Reply To: Temp Tbl

    JigarShah wrote:

    You might also need to restart your DB services on a frequent basis in order to free up tempDB free space.

    -- JigarShah

    No, you should (almost) never need to restart...

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

  • Reply To: how to lock the record

    Jeff Moden wrote:

    ScottPletcher wrote:

    Indirectly, yes there is, and it's a guaranteed locking approach, since it's provided by the db engine itself, and uses its own locking mechanisms internally.

    Use system procs sys.sp_getapplock...

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

  • Reply To: how to lock the record

    Indirectly, yes there is, and it's a guaranteed locking approach, since it's provided by the db engine itself, and uses its own locking mechanisms internally.

    Use system procs sys.sp_getapplock and sys.sp_releaseapplock.

    Before...

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

  • Reply To: Finding Free Space

    marsigme wrote:

    The question ask for the amount of free space, correct? ... Really didn't think any of the answers were complete since ... you needed to use the size from...

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

  • Reply To: Using subquery count to subtract from main query count

    SELECT count(c.people_id) AS 'Inactives' --<<-- note counting from *right* table
    FROM [BCC_DB].[dbo].[People] p
    LEFT OUTER JOIN --<<-- note *LEFT* join
    [BCC_DB].[dbo].[certs] c
    ON p.peopleId = c.peopleId
    WHERE p.status = 1
    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".

  • Reply To: Distance Zip Code Database

    Presumably you want the driving distance and not the "as the crow files" (straight linear) distance.  For that you will need a software package.  You will also need to get...

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

  • Reply To: Running Totals by Date and Account

    ...

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

  • Reply To: Running Totals by Date and Account

    ...

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

  • Reply To: Need help with a Query

    The codes look ok.  Something else must be causing your issue.

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

  • Reply To: Replace TABLE with STAGING_TABLE. Approach?

    You can use a query to see which table the view is currently pointing at:

    SELECT referenced_schema_name, referenced_entity_name

    FROM sys.sql_expression_dependencies

    WHERE referencing_id = OBJECT_ID('dbo.Clients')

    Also, I'd suggest creating a log table in which 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".

  • Reply To: Clustered Columnstore Index and Partition Elimination

    I don't think so, I think 0 should mean your query accessed no partitions.  If it had accessed all of them, the total number of partitions should be there.

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

  • Reply To: One table or two?

    I would never combine these tables.

    I'd be much more concerned with determining the best clustered keys for each table.  Or whether, perhaps, they would best be heaps (individual rows are...

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

  • Reply To: repeating block of records

    Can you post directly usable data, i.e., CREATE TABLE and INSERT statements.

    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 - 2,611 through 2,625 (of 7,619 total)