Forum Replies Created

Viewing 15 posts - 631 through 645 (of 7,619 total)

  • Reply To: Grant user permissions to a view but the base tables live in another database

    First I would think would be to try this:

    GRANT SELECT ON dbo.view_name TO [domain\account];

    GRANT SELECT ON dbo.view_name2 ...

     

    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: How to run a query multiple times with different values in date

    Use a table to store the date ranges, then join to that.

    DROP TABLE IF EXISTS #DATES;
    CREATE TABLE #DATES (
    VARIABLEA date NOT NULL,
    ...

    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: The ORDER BY clause is invalid in views

    You're also going to need to do something about the:

    ar.Account_B__c as Account_ID,

    a.SalesOrg__c as SalesOrg,

    columns.  They are not in the GROUP BY and they are not within an aggregate function, so...

    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: Shrink database issue

    Best would be not to shrink the main db at all.  If possible, add a secondary filegroup, create the temp tables in there, then shrink only the file(s) in that...

    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: Migration of simple SPs from 120 to 150 COMPATIBILITY_LEVEL issue.

    You're good there, so that's not part of the issue.

    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: Migration of simple SPs from 120 to 150 COMPATIBILITY_LEVEL issue.

    Are you on the latest CU(patch-level)?

    Have you verified that the threshold for parallelism setting is not too low?

    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: table design for user "matching"

    Btw, neither "matched" nor "user_id" are SQL Server reserved keywords.

    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: table design for user "matching"

    A trigger makes the most sense to me, so that the assignments are immediate.  You would also need a DELETE trigger to remove interested / mutual for a deleted user_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".

  • Reply To: Need some expert help from the masters

    Btw, as noted by some others, I too, fortunately, have never seen any automated tool that can really properly analyze index usage and make really good suggestions for changes.  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: Need some expert help from the masters

    SQL already captures the vast bulk of the stats you need, thus you don't generally have to set up separate runs, etc. to capture activity.

    If you're willing to run 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: how to change hard coded dates to ytd please

    DECLARE @EndDate date
    DECLARE @StartDate date

    SET @StartDate = '20220101' --<<-- change @Start and @End values to get any date range you want
    --get end of current month
    SET @EndDate =...

    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: Removing a Column

    Btw, you should always specify nullability (NULL / NOT NULL) when ADDing a column, otherwise it's extremely difficult to determine what you'll get there.

    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: Selecting State from table based on a Begin and End Date

    To get the last datetime for a given set of datetimes, you'd typically use ROW_NUMBER(), like this:

    select ...
    From (
    select *, row_numnber() over(partition by...

    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: Need some expert help from the masters

    ScottPletcher wrote:

    Jeff Moden wrote:

    igaytwanb wrote:

    Hello everyone!

    I am in dire need of some assistance or direction. I am by no means a expert at any of this stuff. Unfortunately for me 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: Need some expert help from the masters

    Jeff Moden wrote:

    igaytwanb wrote:

    Hello everyone!

    I am in dire need of some assistance or direction. I am by no means a expert at any of this stuff. Unfortunately for me the company...

    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 - 631 through 645 (of 7,619 total)