Forum Replies Created

Viewing 15 posts - 2,761 through 2,775 (of 7,619 total)

  • Reply To: Cannot create a row of size XXXX which is greater than the allowable maximum row size of 8060

    Forced-off-row types require only a 16-byte pointer.  The 2-byte variable-length overhead per pointer, though, causes even fewer than 500 columns to be possible [I thought SQL would be able to...

    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: Group multiple Transaction Types in 1 Row by Count

     

    SELECT
    Yr, Pd, Loc,
    SUM(Complete) AS Complete,
    SUM(Pending) AS Pending,
    SUM(Canceled) AS Canceled,
    ...

    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: Cannot create a row of size XXXX which is greater than the allowable maximum row size of 8060

    If using nvarchar(max), in particular, you can simply force the large values off the page into LOB/overflow area.

    After creating the table, but before loading it, run the following command:

    EXEC sys.sp_tableoption...

    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: Interview Question - Query Required

    Like so:

    SELECT EmpName,
    MAX(CASE WHEN row_num = 1 THEN Item END) AS item1,
    MAX(CASE WHEN row_num = 2 THEN Item 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".

  • Reply To: Does ERROR_LINE () ignore 'USE' etc.?

    If I need to know the location, I usually set a variable with a location id that is unique.

    DECLARE @code_location varchar(20)
    SET @code_location = '1000-SELECT'
    BEGIN TRY
    ...
    END TRY
    BEGIN CATCH
    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: Long name in TSQL is creating errors

    Just create a separate drive path for backups on that machine and, to keep it simple, make sure there are no spaces or other unexpected chars in the path name.

    Btw,...

    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: Left join not pulling all from left table

    For an OUTER JOIN, you must put conditions on the possibly-missing table in the JOIN clause, not in the WHERE clause.

    select * from #temp1 T

    left join #temp2...

    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: Joining two tables using wild cards to populate a third

    I don't know about the overall logic, but the JOINs above seem needlessly convoluted.  Instead, maybe:

      INNER JOIN #UserB AS B
    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: In a t-sql 2012, I can trying to make a case statement work in an update statem

    I think the Milestone table does not contain a column named "TOT_ABSENCES".  Please review the column names in the Milestone table.

    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: delete last 9 h

    Create an index keyed on pbRecordId on that table.

    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: Index Size Question

    The clustered index is the table itself.  That is, all columns are stored in the clustered index.  Thus, the width is the total width of the entire row.

    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: Create tables from metadatatable

    The system itself already has all the metadata views you need.  It's best to just use those views: sys.objects, sys.columns, sys.key_constraints, etc..

    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 compress indices without rebuilding them

    I too would not drop compression to do a load, especially a large one.  Page compression can help data load much faster by reducing I/O (compression takes more CPU but...

    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: Seeing a lot of HEAPS tables with large row counts on prod. Is this a problem ?

    If these are staging tables, just be sure to TRUNCATE the table rather than DELETE the rows.  TRUNCATE will keep the table allocations clean without having to create a clustering...

    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: T-SQl or Store Procedure which fit better

    I prefer to use CROSS APPLY(s) for such calcs.

    Select emp_code, emp_name,emp_last_name, emp_max_pay, emp_yearly_salary
    From dbo.table_name
    Cross Apply (
    Select case when emp_max_pay < 10000 then emp_max_pay...

    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,761 through 2,775 (of 7,619 total)