Forum Replies Created

Viewing 15 posts - 5,041 through 5,055 (of 7,613 total)

  • RE: HELP - Database in Recovery Pending

    Add another log file to the db. Put it on a drive with plenty of space. Allow SQL time to get caught up on log writes, and 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: Select Maximum, using filelds from 2 tables

    drew.allen (6/11/2015)


    ScottPletcher (6/11/2015)


    You can't add Librarian id into the GROUP BY and accurately answer the query, since multiple librarians could have the same surname. You could pre-aggregate, but 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".

  • RE: Select Maximum, using filelds from 2 tables

    You can't add Librarian id into the GROUP BY and accurately answer the query, since multiple librarians could have the same surname. You could pre-aggregate, but you must still...

    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: Need help for paaing table name and date as variable in dynamic sql

    I admit I can't imagine this type of proc being exposed to an external application or user. It seems much more internal to me, and thus the chance 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".

  • RE: Need help for paaing table name and date as variable in dynamic sql

    Been busy today, but I think I've got the errors fixed now. I'm definitely not using XML and STUFF when a few simple functions will do. Just 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: Need help for paaing table name and date as variable in dynamic sql

    ALTER PROCEDURE sampleprocedure

    @tablename AS varchar(4000),

    @date AS date

    AS

    SET NOCOUNT ON;

    DECLARE @query nvarchar(4000);

    SET @query = 'SELECT * FROM ' +

    ...

    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: Looking for clues on a performance problem

    Put in a query hint to force a HASH join. I'd rely more on that than on an ARITHABORT setting.

    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: Need help for paaing table name and date as variable in dynamic sql

    Lynn Pettis (6/10/2015)


    ScottPletcher (6/10/2015)


    Sorry, I was being lazy and didn't include checks for db name and schema:

    ALTER PROCEDURE sampleprocedure

    @tablename AS varchar(4000),

    @date AS...

    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: Need help for paaing table name and date as variable in dynamic sql

    Sorry, I was being lazy and didn't include checks for db name and schema:

    ALTER PROCEDURE sampleprocedure

    @tablename AS varchar(4000),

    @date AS date

    AS

    SET NOCOUNT ON;

    DECLARE...

    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: Need help for paaing table name and date as variable in dynamic sql

    CREATE PROCEDURE sampleprocedure

    @tablename AS varchar(4000),

    @date AS date

    AS

    SET NOCOUNT ON;

    DECLARE @query nvarchar(4000);

    SET @query = 'SELECT * FROM ' + QUOTENAME(@tablename) +

    ...

    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: Joins and Indexes - need indexes on both sides of a join?

    In the above sample, would there be an advantage to having indexes on the otherrefkey and refentrykey columns in MainTable?

    No, except in perhaps extraordinarily rare cases.

    As a secondary question, will...

    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 change columns based on another field value

    DECLARE @MyVari varchar(20)

    SELECT [ProductID]

    ,[prod].[Name]

    ,[ProductNumber]

    ,[MakeFlag]

    ,[FinishedGoodsFlag]

    ,[MyRow] = @MyVari

    FROM [AdventureWorks2014].[Production].[Product] prod

    INNER JOIN [Production].[ProductModel] Prodmod

    ON prod.Name = Prodmod.name

    WHERE @MyVari = Case When [Production].[Product].[MakeFlag] = 0

    ...

    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 use uniqueidentifiers in a where clause not in select statement of uniqueidentifiers

    ...

    where o.person_id not in (select distinct person_id from #wch_have where person_id is 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".

  • RE: Help with date table

    Ed Wagner (6/5/2015)


    ScottPletcher (6/5/2015)


    If they're always Mondays, why waste resources with table I/O at all? Very simple date arithmetic can tell you what the starting and ending dates are.

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

  • RE: Help with date table

    If they're always Mondays, why waste resources with table I/O at all? Very simple date arithmetic can tell you what the starting and ending dates are.

    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,041 through 5,055 (of 7,613 total)