Forum Replies Created

Viewing 15 posts - 4,846 through 4,860 (of 7,619 total)

  • RE: Finding all relations between tables. How ?

    select

    OBJECT_NAME(constraint_object_id) constraint_naam

    , constraint_column_id as constraint_column_sequence

    , OBJECT_NAME(parent_object_id) Child_table

    , parent_column_id

    , COL_NAME(parent_object_id, parent_column_id) as child_column

    , OBJECT_NAME(referenced_object_id) Parent_table

    , referenced_column_id

    , COL_NAME(parent_object_id, parent_column_id) as Parent_column

    into ##C

    from sys.foreign_key_columns

    --order by constraint_naam, constraint_column_sequence

    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: Date format not converting to dd/mm/yy

    When you store dates as character, store them as:

    YYYYMMDD

    which always works under any/all SQL settings.

    For the current data, you put it into that format to check it:

    ...

    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: Getting filepath from a SQL Filetable

    The slowness must be in one of the functions. We would need to see the function code to tune those.

    But you can get rid of the local variables for...

    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 in Performance Tuning

    If the tables are part of a live system, I'd always want to see at least the current missing index stats and index usage stats from SQL itself (cardinality can...

    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 in Performance Tuning

    I, too, await what Jeff will propose as the best method to identity the proper clustered indexes, since we clearly very differently weigh what's most important in that regard. ...

    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 list of all the tables used in multiple SQL scripts

    Create a new, work db. Create 275 procs from the existing code. Hopefully that's as as adding "CREATE PROCEDURE proc_NNN AS " to the beginning of the code...

    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 in Performance Tuning

    The most critical element for performance is the best clustered index on every table. That is rarely an identity column.

    Therefore, the first thing you need to do is review...

    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: T-SQL MDF & LDF size for spreadsheet

    Jeff Moden (8/28/2015)


    ScottPletcher (8/28/2015)


    Jeff Moden (8/28/2015)


    Why not just do a [font="Courier New"]SELECT SizeMB = Size/128.0, * FROM sys.Master_Files [/font]and call it a day?

    I thought sys.master_files was not always kept current,...

    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: T-SQL MDF & LDF size for spreadsheet

    Jeff Moden (8/28/2015)


    Why not just do a [font="Courier New"]SELECT SizeMB = Size/128.0, * FROM sys.Master_Files [/font]and call it a day?

    I thought sys.master_files was not always kept current, particularly for tempdb.

    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: General question concerning Users and allowing SQL queries on a database

    Jeff Moden (8/28/2015)


    ScottPletcher (8/28/2015)


    The point is to run a business, not have a perfect environment for the db itself.

    Yes, much care needs to be taken before allowing anyone to run...

    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: T-SQL MDF & LDF size for spreadsheet

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

    DROP TABLE #db_sizes

    CREATE TABLE #db_sizes (

    db_name varchar(100) NOT NULL,

    data_size_kb bigint 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: Cursor function and drop user/logon

    DECLARE @sqlVersion smallint;

    DECLARE @UserName nvarchar(100);

    SELECT @sqlVersion = LEFT(ProductVersion, CHARINDEX('.', ProductVersion) - 1)

    FROM (

    SELECT CAST(SERVERPROPERTY('ProductVersion') AS varchar(30)) AS ProductVersion

    ) AS system_value

    --get all user/login names that need removed...

    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: Update statement: use the in clause or run simple update 500 times

    Look at the query plan, and see if it is scanning the clustered index or doing keyed lookups by joining to a table of constants. If it's a scan,...

    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: Granting Explicit View Definition Permissions on Stored Procedure to dbo

    Maybe you could create a dummy user in the db, have the main user EXECUTE AS that user to give him/herself permission, then REVERT back to their own id for...

    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: General question concerning Users and allowing SQL queries on a database

    Ed Wagner (8/28/2015)


    Scott, I agree with you that the point is to run a business. You raise a good point about perspective. It may be that cutting off...

    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,846 through 4,860 (of 7,619 total)