Forum Replies Created

Viewing 15 posts - 7,006 through 7,020 (of 7,613 total)

  • RE: Change column from NVARCHAR to VARCHAR...

    PiMané (12/18/2012)


    ScottPletcher (12/17/2012)


    Since you have to ALTER columns only one at a time (why, MS, why??), I'd create a new table and INSERT every row into it, converting every 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: Change column from NVARCHAR to VARCHAR...

    Since you have to ALTER columns only one at a time (why, MS, why??), I'd create a new table and INSERT every row into it, converting every column at one...

    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: IF statement with subquery problem

    sp_MSforeachdb is convenient, but it has huge overhead and is probably overkill for what you need.

    You can use sp_executesql to return a value from dynamic SQL, albeit that it's not...

    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: Missing Indexes on Temp tables

    TheSQLGuru (12/16/2012)


    My statement about making "queries" faster is about the ENTIRE process. The act of populating a temp table with an index already on the temp table before data...

    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: Grouping by time - can't figure this out!

    If I understand correctly, maybe something like below.

    [Btw, as a general performance guideline, make sure the datatype of the time in the table exactly matches your list of times. ...

    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: Value of column dependent on the values of others. How can I do it . Please help !

    And don't forget about computed columns. You can make this a computed column, so you don't have to have the generating code in a trigger. Since it'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".

  • RE: Missing Indexes on Temp tables

    I disagree completely.

    I've repeatedly gotten huge performance gains sometimes by indexing temp tables properly. They are tables like any other table, after all. For large tables, I've seen...

    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 easy way to make 3 lines per child

    You could also use an INNER JOIN to a hard-coded table:

    select

    case parents.whichParent when 'father' then s.father when mother then s.mother else s.parent_guardian end,

    ...

    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 combinations of values

    CELKO (12/14/2012)


    [ Yiikes, that's incredibly convoluted. What a royal pita to try to understand, much less change or debug later!!

    But it is fast and portable 😀

    On a more serious...

    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 combinations of values

    CELKO (12/14/2012)


    .. Total failure.. Besides which, I believe my earlier post was the same idea, except coded correctly 🙂 .

    Yeah, it was awful! :crazy:

    What I wanted to do was...

    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 with a query

    Sorry, I didn't have test data so I couldn't pre-test it myself.

    If you'll post some data as INSERT statements, I'll be happy to correct 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: Finding combinations of values

    GSquared (12/14/2012)


    CELKO (12/13/2012)


    My table structure

    Please read just one little book on SQL and RDBMS. Please, just one little book! This is not a table; it has no key;...

    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 combinations of values

    CELKO (12/13/2012)


    My table structure

    Please read just one little book on SQL and RDBMS. Please, just one little book! This is not a table; it has no key; it...

    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 with a query

    SELECT object_name, database_name, DATEPART(Week, event_time) AS EventWeek, SUM(sequence_number) AS [#TimesAccessed],

    DATEADD(HOUR, DATEDIFF(HOUR, 0, event_time), 0) AS [EventHour]

    INTO #EventHour

    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: Query for a plus sign

    ScottPletcher (12/12/2012)


    CELKO (12/11/2012)


    In COBOL, the display and the internal format of data was the same. Each field had a PICTURE clause to define it. Your question makes sense only in...

    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 - 7,006 through 7,020 (of 7,613 total)