Forum Replies Created

Viewing 15 posts - 2,431 through 2,445 (of 7,613 total)

  • Reply To: Concatenating to a string

    Phil Parkin wrote:

    I'd make it less cluttered by using a variable for the literal single quote:

    DECLARE @H CHAR(1) = '''';

    the CONCAT version then becomes something like this:

    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: Concatenating to a string

     

    '''' + p.firstname + ''',''' +
    p.lastname + ''',''' +
    i.city + ''',''' +
    t.stateAbbrveation + ''',''' +
    Convert(char(5), c.peopleId) + ''''
    as insert_string

    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: Restore

    Every SQL database restore must start with a full backup restore.

    After that, you can, if you want to, restore a differential backup (that was taken after the full backup 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: SELECT from COLUMN if exists

    Use this to generate the SELECT statements to review.  After you've verified the statements, run them if / as you see fit.

    DECLARE @DTCHANGEDON_found bit
    DECLARE @DTCREATEDON_found bit
    DECLARE @end_date...

    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: Get a couple fruits

    You really should start using the new syntax, with parentheses around the row count:

    SELECT TOP (2) *

    FROM STRING_SPLIT(@s, ',') AS ss

    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: DBCC SHRINKFILE EMPTYFILE Running REALLY Slow

    Make sure you pre-allocate enough log space to handle any logging required.  If the log file has to grow dynamically, that will be very slow.

    Make sure the new data files...

    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: WITH Query definition not working

    Maybe a permissions issue?  I don't see why drives wouldn't show up for that query.

    That code is extremely inefficient though, since it pulls drive info once for every file, instead...

    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: TDE related questions

    Ultimately any part of a disk drive file can be corrupted (or attacked?).  A bad controller, etc., can cause unexpected corruption.

    Again, it's my understanding that there is no way 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".

  • Reply To: Could you list db modeling tools you use on daily basis?

    It's very difficult for many people to split the logical and physical design.  But, it's critical to a good design that you keep the two separate.  Getting a developer involved...

    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: TDE related questions

    As I understand it, if you lose the certificate, you can't read the data, period.  Back up that certificate and make sure you can restore 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".

  • Reply To: Could you list db modeling tools you use on daily basis?

    IIRC, from the one time long ago I looked at SQL Diagrams, it is only a physical design, there is no separation of logical and physical.  If you don't distinguish...

    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: Scalar function too slow - Calculated field in column based on another columns

    I would think you could summarize the data just once, for all BSP ranges and WIN/LOSS combos, then join to that, if needed, to get the final result.  I 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".

  • Reply To: Query Tuning Question

    Jeff Moden wrote:

    coolchaitu wrote:

    Is query tuning the responsibilty of a Developer or is it a combined responsibility of DBA and SQL Developer.

    jonathan.crawford wrote:

    You simply do your best. If you are not...

    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 databases with no dependencies

    The referencing_id would always be the current db, I would think.

    You should check the referenced_server_name as well as the db name.  It's possible that local db1 could point to 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: count(*) locking a table?

    Grant Fritchey wrote:

    Jonathan AC Roberts wrote:

    It's the insert and update that are locking the table.

    You can ignore these locks by using the nolock hint:

    select count(*) 
    from mytable 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".

  • Viewing 15 posts - 2,431 through 2,445 (of 7,613 total)