Forum Replies Created

Viewing 15 posts - 6,916 through 6,930 (of 7,619 total)

  • RE: Import data from one table to another excluding any duplicates help

    INSERT INTO dbo.T1 ( ... )

    SELECT t2.col1, t2.col2, ...

    FROM dbo.T2 t2

    LEFT OUTER JOIN dbo.T1 t1 ON

    t1.Name = t2.Name

    WHERE

    t1.Name IS NULL --only include...

    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: Not a Valid DateTime Data Type

    The first is a datetime2 format, the second is a datetime format.

    Try CASTing to datetime2 first, then CASTing that to datetime.

    CAST(CAST(column_name AS datetime2) AS datetime)

    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: find out data file is splits to multiple files?

    SELECT *

    FROM <db_name>.sys.database_files

    WHERE

    type_desc <> 'LOG'

    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: Index Question

    DBA24 (1/17/2013)


    Hello All,

    I have a primary key on a column that is a unique identifier (width 32 char) and it is nonclustered. There are a lot of inserts, updates 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: Nested replaces ?

    For that, I would use a function with PATINDEX to retain only the desired chars.

    If performance is not an issue, you can use a scalar function.

    I can give you a...

    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: Need help on indexing

    Better yet, forget the dopey "cluster first by identity" and cluster the table the best way: that is THE most important thing for performance.

    Based on what you've posted, it seems...

    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: orphaned extended properties in SQL

    As Lowell states, they're not really orphaned.

    Extended properties that aren't explicitly subordinated to a db object apply to the db itself.

    That is, if you add extended properties w/o specifying a...

    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: Not getting results expected from a Group by query

    All I can see from what you've posted so far is the check for:

    activeclient > 0

    in the subquery (patient count) but not in the outer query (attendance count).

    It seems possible...

    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: I'm trying to create a proc that will drop and create a function

    The "sqlcmd" utility does recognize "GO", as well as many other things, including invoking OS cmds.

    I think you should be able to use "sqlcmd" to run the scripts.

    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 Security Best Practices - Dealing With User Name Changes

    opc.three (1/14/2013)


    YSLGuru (1/14/2013)


    opc.three (1/12/2013)


    AD Groups as SQL Logins and Database Users work great unless you need the User to have a default schema. In SQL 2012 the loop has been...

    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 Security Best Practices - Dealing With User Name Changes

    Yes, I would change the specific SQL user login to match the person's name, if all/part of the name itself is being used as part of the login.

    Use roles, where...

    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: Does Change Data Capture require a table have a primary key

    CDC requires a unique index. That makes sense given what it has to be able to do.

    I think by default it uses the PK as the unique index, but...

    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: Hard disk full

    If the log is on the same drive, don't purge any data until you've given the log more space!

    If the log is out of space, and particularly if it getting...

    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: trigger problem

    Any chance that either or both "TransferToCostCenter" and "TransferFromCostCenter" are NULL?

    Not equal won't work on NULL; you'll have to explicitly allow for NULL in the comparison.

    For example:

    WHERE ...

    ...

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

    If the computation "size / 1024 / 1024" yielded 96 gbsize,

    the correct computation of "size / 128 / 1024" would yield 8 times that, or:

    ~768gb

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