Hot answers tagged

8

To say MAXDOP=1 is always beneficial is totally incorrect statement. MAXDOP value should be set according to SQL Server CPU core configuration followed by a good round of testing. Few applications I know that woks good with MAXDOP 1 is DynamicsAX and Sharepoint. Yes ghost cleanup is single threaded as mentioned by Paul in this article but just because ...


5

As long as they are not nested, you should be fine. @@FETCH_STATUS is set at the time the FETCH NEXT is performed. @@FETCH_STATUS is global to the session, not the entire server. There is no equivalent to SCOPE_IDENTITY() for @@FETCH_STATUS. If you need to nest looped FETCH NEXT operations, make sure that your outer FETCH NEXT is performed after the inner ...


4

Guessing at column names: INSERT #temp(dateColumn) SELECT dateColumn FROM dbo.WorkCalendar WHERE IsWorkDay = 1 AND dateColumn >= @begindate AND dateColumn < DATEADD(DAY, 1, @enddate); Also please try to avoid regional formats like m/d/y. These will bite you in the end, because someone will run your code on a server with different language ...


3

You can just remove the WITH XMLNAMESPACES(DEFAULT 'https://XYZ.xsd') part: DECLARE @XML XML SET @XML = '<NodeA> <NodeB verzePis=""> <NodeC1 attrA="Hello" /> <NodeC2 attrA="World" /> </NodeB> </NodeA> ' ;--WITH XMLNAMESPACES(DEFAULT 'https://XYZ.xsd') SELECT r.value('fn:local-name(.)', ...


2

First, make sure your SQL Server is fully patched and up to date. For 2008 R2, at this time I'd say the hard minimum is build 10.50.6220 (SP3 + MS15-058), and you really should be at 10.50.6537 (SP3 + MS15-058 + TLS 1.2 capability). Second, make sure you have a unique index on the combination of NetworkUserID, NetworkID (with the highest cardinality one of ...


2

Just in case you are still interested, there is a potential workaround you can employ. Here is the updated code, which introduces the #deferResolution temporary table to each query in the procedure. Because the temporary table will only exist at runtime, the procedure is able to compile even though the proper columns don't yet exist on myTable. You will ...


2

After digging into the backup logs between LiteSpeed and SQL Server I noticed that the first LSN number between the daily full backup and the full backup LSN number in differential backups didn't match up. After doing some reading on how the LSN values are used in the backups of the database I did some digging on what would cause the full backup's LSN ...


1

The Import/Export wizard builds an SSIS package under the covers but the package the wizard builds only performs the E and L of ETL (Extract, Transform, Load). What you're looking for is T because you needed to transform this weird data into something more manageable. For the weird header row, you can always specify that there is no header row and the ...


1

I second the suggestion of a unique index on NetworkId+NetworkUserId. Incorrect results may be due to the way you're writing to that table unsafely. You have no transaction there and no locks being held on the table while performing reads and writes. I suggest that you rewrite your procedure with a MERGE statement: CREATE PROCEDURE [dbo].[Procedure] ...


1

One way is to calculate the aggregate inside a CTE (I blogged about this last month): ;WITH CTE AS ( SELECT time1, time2, t2 = SUM(time1) OVER() FROM #abcd ) UPDATE CTE SET time2 = t2/60/60; But I don't understand the value of putting the same SUM(), aggregated over the whole table, into that column for every single row. Seems easier to just store ...



Only top voted, non community-wiki answers of a minimum length are eligible