Forum Replies Created

Viewing 15 posts - 4,591 through 4,605 (of 7,619 total)

  • RE: Date Parameter in Stored Procs

    SQLPain (12/7/2015)


    Thanks Scott, I appreciate your help, but not passing the year, wouldn't it do a count of all the years for that month, for example in future if I...

    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: Date Parameter in Stored Procs

    Sure, fine, I give up.

    Just be aware that using MONTH or any other function on a column could give you horrible performance.

    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: Date Parameter in Stored Procs

    Month is a datetime type: you need to provide a full date:

    @month = '20151001'

    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: Date Parameter in Stored Procs

    The CROSS JOIN is just used to assign an alias name to the constructed 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".

  • RE: Date Parameter in Stored Procs

    SQLPain (12/7/2015)


    Scott, would the following work, its kind of giving me the correct results:

    ALTER PROC Applications

    (

    @Month AS DATETIME,

    @Year AS DATETIME

    )

    AS

    BEGIN

    LEFT JOIN (SELECT COUNT(CA.app_id) AS Approved_Count, SO.source_id

    ...

    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: Date Parameter in Stored Procs

    SQLPain (12/7/2015)


    Scott, would the following work, its kind of giving me the correct results:

    ALTER PROC Applications

    (

    @Month AS DATETIME,

    @Year AS DATETIME

    )

    AS

    BEGIN

    LEFT JOIN (SELECT COUNT(CA.app_id) AS Approved_Count, SO.source_id

    ...

    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: Table vs View vs UserDefined Function - Which will give more performance

    You'll get best performance only from properly clustering the underlying table. Then either a direct query or a view should perform just fine.

    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: Selecting the record with the “nearest” date

    TheSQLGuru (12/4/2015)


    The simplest solution by far would seem to be fix the data. 🙂 Update all NULL start-date values to the minimum for the data type (1/1/1753 for full 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: Date Parameter in Stored Procs

    Code below should filter it for a single month, as specified in @month:

    LEFT JOIN (SELECT COUNT(CA.app_id) AS Approved_Count, SO.source_id

    ...

    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: Flag the old column to 0 when new record is inserted!

    I'd urge you to use triggers rather than application code for this type of thing. This makes sure the code is consistently applied and prevents having to re-write code...

    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: Help Needed in dynamic sql

    I'd create such a proc in the master db and mark it as a system object so that it could be used in all dbs.

    I'd also at least:

    1) optionally allow...

    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: Query processor could not produce a query plan because of the hints defined in this query.

    In more detail, index "FDX_spG_NU_QA_V12" does not contain at least one of the columns:

    MC.col1 / MC.col2 / MC.col3

    If you believe such an index could be helpful enough to this 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: SQL memory is very high

    It was my understanding that SQL only acquired RAM when it needed it. That is, it doesn't automatically grab the max ram as soon as it starts. Of...

    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 Risk\Impact of Partitioning

    Using the spreadsheet I just posted, let's look at the xactControlPoint table. Notice my script adds an "ident" column before each missing index stat. That is to reference...

    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 Risk\Impact of Partitioning

    --Edit: removed, exact dup of next post, I got an error during posting and didn't realize it had actually posted anyway.--

    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 - 4,591 through 4,605 (of 7,619 total)