Forum Replies Created

Viewing 15 posts - 5,131 through 5,145 (of 7,613 total)

  • RE: Creating Primary Key on temporary table question

    ScottPletcher (4/30/2015)


    Don't name the constraint, as constraint names have to be unique.

    ALTER TABLE dbo.test

    ADD PRIMARY KEY CLUSTERED

    ( ReportRunTime, VisitID, SourceID, BaseID, OccurrenceSeqID, [DateTime], SeqID, QueryID, Response );

    The original version was...

    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: Creating Primary Key on temporary table question

    Don't name the constraint, as constraint names have to be unique.

    ALTER TABLE dbo.test

    ADD PRIMARY KEY CLUSTERED

    ( ReportRunTime, VisitID, SourceID, BaseID, OccurrenceSeqID, [DateTime], SeqID, QueryID, Response );

    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: Trouble playing with dates

    SELECT MONTH(Anniversaire) AS MM, DAY(Anniversaire) AS DD, Anniversaire, Prenom, Nom

    FROM Tbl_RH_Pharmacie

    WHERE (Anniversaire IS NOT NULL AND Anniversaire <> '') AND

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

  • RE: Move tables and SP from Master to user DB

    I wonder why Transaction log of MASTER can be full ( The recovery model is simple )

    You can't back up a log in simple recovery model (because the log would...

    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: One stored procedure to do Add, Update, Select and Delete

    I believe SQL will compile all statements when the proc is loaded, so there's overhead there.

    If you do this, though, at least make it as efficient as possible by using...

    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: Move tables and SP from Master to user DB

    Since the default db is master, often things get built there by accident. You can create a DDL trigger to prevent that from happening again, if you want.

    You 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: Performance problems with bulk insert command

    Make sure the log file has enough unused space to handle the bulk-insert logging before the insert starts. Dynamically growing the log file is an extremely slow process. ...

    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 2012 Warning: Null value is eliminated by an aggregate or other SET operation.

    sum(case when (coalesce(a.status,ae.status) = 'A')

    and (ae.excuse is null or ae.excuse = 'U')

    ...

    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: Findout the type of replication Pull or Push

    The MSsubscriptions table has a column:

    subscription_type

    that identifies which it 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: substituate the hour part of a datetime field

    SELECT *, DATEADD(HOUR, HourPlanned, DATEADD(DAY, DATEDIFF(DAY, 0, lnDateDone), 0))

    FROM (

    SELECT lnDateDone = '2014-04-09 13:22:31.544', HourPlanned = 14

    ) AS test_data

    Edit: Corrected calcs and added test 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: Where and or

    I think (hopefully) all the conditions except a NULL (incoming) @Gender can be handled by:

    (@Seeking IS NULL OR p.Gender = @Seeking) AND p.Seeking = @Gender

    What "matches" do you want 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 ID and Primary Key to Large Table(s)

    Don't add an id as a PK, just use MsgDate and MsgTime as the (nonunique) clustering keys. That's how you'll lookup and process this data anyway.

    I can't imagine how...

    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: Non-Clustered Primary Key and Non-Unique Clustered Index Questions

    I'd consider clustering by only customer_id, unless the selects themselves order by both customer_id and thing_id.

    I'd also use a lower fillfactor for these indexes, maybe starting somewhere between 80% 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: Indexing a large table

    Do you really search this table by NoteType without specifying a CreateDate range? Could you specify CreateDate range?

    This table should be clustered on CreateDate, not on identity; this 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: SQL query help

    CELKO (4/24/2015)


    Of course there is, since you can cast the number to a string any time you want, although you'd never need to compute a check digit that's already...

    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 - 5,131 through 5,145 (of 7,613 total)