Forum Replies Created

Viewing 15 posts - 5,566 through 5,580 (of 7,619 total)

  • RE: Digits only

    It's only 20 chars, I'd do it as simply as possible rather than over-complicate it:

    SELECT MP.RefNum, MP.Phone,

    CASE WHEN SUBSTRING(MP.Phone, 01, 1) LIKE '[0-9]' THEN SUBSTRING(MP.Phone,...

    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: create trigger on update and on insert

    If you just want to do INSERTs to the other table, and not UPDATEs:

    CREATE TRIGGER trigger_name

    ON dbo.CARTOES

    AFTER INSERT, UPDATE

    AS

    SET NOCOUNT ON;

    INSERT INTO dbo.another_table --(column_name1, column_name2, ...)

    SELECT

    [COD_ID],

    [CODCTB],

    [NIFCTB],

    [NOMECTB],

    [DT_EMISSAO],

    [DT_VALIDADE],

    [DT_ANULACAO],

    [DESCR_REP_FISCAL],

    [NUMCARTAO],

    [STATUS],

    [UTILIZADOR]

    FROM inserted

    GO

    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: "Remove Clutered property" from PK

    PiMané (12/16/2014)


    ScottPletcher (12/16/2014)


    Is there any easy way to determine what FKs are "hanging" on the PK?

    Yes, using view "sys.foreign_keys", and, if needed, "sys.foreign_key_columns" as well.

    that's what i'm currently doing...

    select 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".

  • RE: Question regarding mdf and ldf file on a separate drives.

    Yes, you need separate physical drives.

    Smaller, cheaper drives very often work better than a single, more expensive drive. For I/O, the number of spindles is more critical than 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".

  • RE: Creating an alphabetical list with letter header

    Yes, UNION in "A", "B", "C", ..., "Z" to the source table and then sort it, something like this:

    SELECT name

    FROM table_name

    UNION ALL

    SELECT v.letter

    FROM (VALUES('A'),('B'),('C')) AS v(letter)

    ORDER BY name

    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: "Remove Clutered property" from PK

    Is there any easy way to determine what FKs are "hanging" on the PK?

    Yes, using view "sys.foreign_keys", and, if needed, "sys.foreign_key_columns" as well.

    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 All Compressed tables in database - script

    FYI:

    WHERE sp.data_compression > 0

    is more sargable then "<> 0"; avoid <> unless you have to use 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: Fragmented Index - Zero Usage - Zero Updates

    Maybe you could DISABLE the indexes if they are truly never used?

    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: A significant part of sql server process memory has been paged out

    If the server has only 2GB, then you'll have to limit SQL to 1.5GB. Otherwise it will use it all, causing serious memory problems. Yes, you almost certainly...

    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 summary report

    If you want to load variables, then as below. If you just want to list each month, remove the "@Jan = " and put " AS Jan" after 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".

  • RE: Database connection permissions

    You can give them separate permissions in msdb to deal with jobs.

    I can't imagine why you would want people arbitrarily creating maintenance plans, but you should be able to add...

    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: Database connection permissions

    Brandie Tarvin (12/12/2014)


    ramana3327 (12/11/2014)


    SA account is already disabled. so I need to give public server role and map as dbowner for remaining databases right?

    Yes. That will prevent them from accessing...

    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: Drive Spaces - Database size

    Jeff Moden (12/12/2014)


    ramana3327 (12/11/2014)


    I need for existing database.

    If database current size is about 350GB and growth is about 70GB/month. How do you calcaulate the D:/Drive free space and L:/Drive free...

    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: Prevent creating records if certain other records already exist

    Evil Kraig F (12/11/2014)


    RETURN (

    SELECT CASE

    WHEN @optional_letter = ' ' AND EXISTS(SELECT 1 FROM dbo.Test WHERE letter...

    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: Prevent creating records if certain other records already exist

    Emil Bialobrzeski (12/12/2014)


    ScottPletcher (12/11/2014)


    SELECT CASE

    WHEN @optional_letter = ' ' AND EXISTS(SELECT 1 FROM dbo.Test WHERE letter =...

    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,566 through 5,580 (of 7,619 total)