Forum Replies Created

Viewing 15 posts - 6,451 through 6,465 (of 7,619 total)

  • RE: selecting recent two set of log entries from a table with time

    The app should insert a "header" row into a different table when it starts. You can then use that table to pull the log entries.

    If the log table contains...

    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: Omit Data Length for Numeric Values

    You have to go further than that, including considerations of datetime, datetime2, etc..

    NOTE: The code below does NOT consider any user-defined data types.

    ...

    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: Trying to iteratively use PATINDEX commands to comb through a large amount of text

    CleverSQLUserID (8/21/2013)


    ScottPletcher (8/14/2013)


    The code uses LIKE to compare the string, so just construct your string accordingly.

    <snip>

    I'll add code to see the actual part(s) of the text that match if 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: SQL Server Jobs not being scheduled after restart

    Look at the SQL Server Agent error log (separate from SQL Server error log); there will (should) be more info there on why Agent could not start.

    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: Add PK CLUSTERED to existing table with dependencies

    taigovinda (8/20/2013)


    In trying to understand this a bit better, I googled for 'primary key clustered' vs 'unique key clustered' ... if I understand correctly the unique key will NOT prevent...

    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: Add PK CLUSTERED to existing table with dependencies

    Michael Valentine Jones (8/20/2013)


    taigovinda (8/20/2013)


    Hi,

    My database has a bunch of tables on it that have no indexes at all on them. I want to add indexes to these tables...

    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: Add PK CLUSTERED to existing table with dependencies

    ChrisM@Work (8/20/2013)


    ScottPletcher (8/20/2013)


    ChrisM@Work (8/20/2013)

    A primary key doesn’t have to be indexed

    I thought it did. Doesn't SQL always create an index to enforce a PK?

    It has to be indexed to...

    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: Add PK CLUSTERED to existing table with dependencies

    ChrisM@Work (8/20/2013)

    A primary key doesn’t have to be indexed

    I thought it did. Doesn't SQL always create an index to enforce a PK?

    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: Add PK CLUSTERED to existing table with dependencies

    Don't make it a primary key, just make it a unique, clustered index.

    CREATE UNIQUE CLUSTERED INDEX CX_ACC_Name

    ON dbo.ACC_STRUCTURE ( ACC_Name )

    --naturally chg WITH options as needed

    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: Restoring Database From Prod to UAT and Not Restoring USER,ROLES, SCHEMAS

    You could:

    1) restore the db, and immediately issue a USE <restored_db> command and set the db to single user mode;

    2) delete all the users, schemas, etc., that you don't want...

    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: MAXDOP query hint doesn't work- SQL 2008R2 Enterprise Edition

    Erland Sommarskog (8/20/2013)


    curious_sqldba (8/20/2013)


    In sys.sysprocesses wait type is always 'SOS_SCHEDULER_YIELD' when my CTP is 5 and MAXDOP is 0, what do you want me to check in sys.dm_os_tasks ?

    How many...

    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: Returning stored procedure results into a CTE or temp table?

    INSERT INTO #tempTable

    EXEC dbo.someStoredProc

    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: Year to Date Query ... By month?

    Here's one way:

    SELECT

    DATEADD(MONTH, DATEDIFF(MONTH, 0, c.month), 0) AS Month,

    SUM(c.sales) AS Month_Sales

    INTO #Monthly_Totals

    FROM dbo.Car c

    WHERE

    c.month >= '20120401' AND --chg...

    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: MAXDOP query hint doesn't work- SQL 2008R2 Enterprise Edition

    What are the results of this query:

    SELECT

    cpu_count / hyperthread_ratio AS CPUs, *

    FROM sys.dm_os_sys_info

    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: Shrink does not release space

    Data compression should also be considered, if on Enterprise Edition. [My company has some extremely large audit/logging tables that are rarely read. After compressing them, I often shrink...

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