Forum Replies Created

Viewing 15 posts - 5,671 through 5,685 (of 7,620 total)

  • RE: Advance script help. Second Saturday following month?

    stevemr68 (10/28/2014)


    ScottPletcher - This is great but it's showing the 3rd Saturday of the weekend not the second.

    D'OH, quite right, sorry. "13" days should be added, not 19. ...

    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 is not firing on a table

    Yes, "Valued Member", that is basically correct, you do not use parameters like that in a trigger in SQL Server.

    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: Advance script help. Second Saturday following month?

    Do you really need/want two separate scripts? You can do this in one (complex) date computation:

    SELECT

    *,

    DATEADD(DAY, DATEDIFF(DAY, 5, DATEADD(DAY, 19, DATEADD(MONTH,...

    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 is not firing on a table

    The trigger is firing. You must keep in mind that SQL Server only fires a trigger once per statement, no matter how many rows are INSERTed (UPDATEd or DELETEd).

    Therefore,...

    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: Isnumeric function - ISNUMERIC('1E2')

    To check for anything other than only digits (0 thru 9), use:

    NOT LIKE '%[^0-9]%'

    for example:

    SELECT

    TextID,

    CASE WHEN TextID NOT LIKE '%[^0-9]%' THEN 'OK'...

    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: How to count rows of a table in sys.tables

    Everyone be aware that this is a school assignment; reposted perhaps to avoid disclosing that fact and get a "complete solution" instead of just helpful tips.

    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: How to name a column the same name of a tablename

    dariuslearn (10/23/2014)


    ScottPletcher (10/23/2014)


    Sorry [that did seem rather obscure for a starting class on SQL].

    In the SELECT list, after the original column name or expression, you can add "AS new_column_name", 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: How to name a column the same name of a tablename

    Sorry [that did seem rather obscure for a starting class on SQL].

    In the SELECT list, after the original column name or expression, you can add "AS new_column_name", and the query...

    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: Redo: Insert/Update Triggers Causing Problems when an Insert is ran via Script

    I guess rename one of them. But better to avoid using temp tables in a trigger unless absolutely necessary.

    The triggers probably need re-written. Post them here and we...

    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: How to name a column the same name of a tablename

    You can use system procedure:

    sp_rename

    to rename a column. The general format is like this:

    EXEC sp_rename 'table_name.existing_column_name', 'new_column_name', 'COLUMN'

    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: Get Sql Server Ageng Job Id from within a running job

    patrickmcginnis59 10839 (10/23/2014)


    ScottPletcher (10/23/2014)


    arnipetursson (10/23/2014)


    ScottPletcher (10/22/2014)


    You should be able to use the session_id to do the lookup. But since session_ids are reused, and sysjobactivity keeps history, if your proc...

    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: restore a database with more than two data files and more than one log file situation (automated)

    I suggest gen'ing the MOVE clauses directly from @tables, ignoring the count. Just concatenate all the results into a RESTORE statement, and run that statement dynamically. For example:

    ...existing...

    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: Get Sql Server Ageng Job Id from within a running job

    arnipetursson (10/23/2014)


    ScottPletcher (10/22/2014)


    You should be able to use the session_id to do the lookup. But since session_ids are reused, and sysjobactivity keeps history, if your proc is not currently...

    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: Get Sql Server Ageng Job Id from within a running job

    And those same guys obviously did contract work for healthcare.gov! 😀

    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: Finding procedures that use declared table variables

    For temp tables, you must also consider:

    INTO #new_temp_table

    rather than just CREATE.

    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,671 through 5,685 (of 7,620 total)