Forum Replies Created

Viewing 15 posts - 2,326 through 2,340 (of 7,619 total)

  • Reply To: Rebuild index on a 5TB database

    No, on a non-partitioned table, there is no way to build chunks / parts of indexes (frankly I think there should be, but there isn't).

    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: SELECT CASE WHEN to avoid Divide by Zero

    Typically people use a NULLIF like below, to avoid a CASE statement -- whether you prefer that or not is, of course, up to you:

    ISNULL(((JobInfo.EstHrs / NULLIF(JobHrs.ActualHrs, 0)) * 100),...

    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 script that returns all the columns in a table that have data in them

    If the NULL determination was not a 1-time thing, but needed to be periodically available, I'd use triggers to maintain a counter per column in another table that "told" me...

    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 script that returns all the columns in a table that have data in them

    sgmunson wrote:

    pietlinden wrote:

    That's what I assumed it meant. Other interpretations didn't make sense. I suppose writing the table name and column name to at least a temporary table and then...

    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 script that returns all the columns in a table that have data in them

    I'm not sure specifically what the OP meant by "records [presumably meaning rows] for only the columns that have data in them".

    Does that mean rows with NO null columns at...

    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: Map ViewName.ColumnName and TableName.ColumnName

    Nice.  Don't feel bad, we have views that do this:

    SELECT ...

    FROM OPENQUERY(remoteserver1, '...')

    UNION ALL

    SELECT...

    FROM OPENQUERY(removeserver2, '...')

    UNION ALL

    SELECT ...

    FROM dbo.local_table

    No way to match up all the sources to the destination for...

    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: Function has started failing with error unless recreated daily

    Does the function use schema binding?

    Please provide the text of the function, naturally first obscuring any names you need to protect.

    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: Map ViewName.ColumnName and TableName.ColumnName

    I don't see any way to do this.  A view could have columns from several different referenced entities and from no referenced entity at all (such as CREATE VIEW dbo.view_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".

  • Reply To: Cutting out the middleman DBA: how to give access without involving DBA

    SQL has an easy built-in way.  When the analysts are given SELECT permission, the DBA can add the "WITH GRANT OPTION" to their permissions.  That gives them permissions to grant...

    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: Msg 319, Level 15, State 1, Line 2152 Incorrect syntax near the keyword 'with'.

    No, that should do it, it must be something else.

    Can you copy out the statements around where the error occurs and parse those directly and see if you can spot...

    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: What am I doing wrong? OR with AND logic

    Or maybe you need this?!:

    ...

    AND SOURCE_ID <> 100 AND ADDRESS <> 'NOT APPLICABLE'

    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: Msg 319, Level 15, State 1, Line 2152 Incorrect syntax near the keyword 'with'.

    Those statements look fine.  There must be one or more CREATE statements with some other syntax or name error which causes SQL to then misinterpret some SQL later on.

    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: PIVOT table with more than one aggregate and for only weeks with data.

    Jeffrey Williams wrote:

    (named 'date' which is a really bad name because it is a reserved word).

    It's actually not a reserved SQL Server keyword.  [It is reserved in ODBC, but that's 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".

  • Reply To: Subquery in WHERE clause not working

    You'll need to split the list of RelatedPlanNumbers, but that's easy enough:

    AND PlanID IN
    (SELECT
    ...

    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: Send me an email if this job run longer than 30 minutes

    As I noted earlier, you could also pass values to the monitoring job to control the check time interval and/or the options for how many times to check on 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".

Viewing 15 posts - 2,326 through 2,340 (of 7,619 total)