29,301 reputation
772123
bio website
location United Kingdom
age
visits member for 3 years, 2 months
seen 6 hours ago

Email: stackoverflowmartinsmith@gmail.com


Dec
15
comment Identical tables, identical columns, identical records, but why different record sizes?
@PavelNefyodov - Probably they are including the column count offset AKA NULL bitmap offset (depends where you are counting from) in that Null_Bitmap as otherwise the fixed overhead would need to be 6.
Dec
15
comment Identical tables, identical columns, identical records, but why different record sizes?
@PavelNefyodov - The easiest way to see that would be to create a table with less than 8 columns but for which the row size would be above the 9 byte minimum. Then you no longer have that unused byte confusing things. Or see Paul Randal's example here where it happens to use a single byte. (Byte 10 in his case)
Dec
14
comment How to join a table with a table valued function?
@ShaulBehr not many competing answerers about on a Sunday!
Dec
14
comment Is it possible to define a function within a stored procedure?
(1) Is the datatype of CalcField the same in all cases? (2) Your current queries aren't valid without GROUP BY. Are you grouping by the same thing in all cases?
Dec
12
comment How to get COUNT of a range between 2 columns
So if you need it broken out by day there must be a date part somewhere?
Dec
12
comment How to export an image column to files in SQL Server?
I'd probably knock up a simple SSIS dataflow with an Export Column Transformation
Dec
12
comment XACT_ABORT OFF vs COMMIT in trigger
Look into service broker to kick off these other processes in another transaction.
Dec
12
comment SQL Server 2008 R2 SP2 Execution Plan not getting missing index suggestions
Why have you come to the conclusion that the collation has anything to do with this query or the missing index suggestions not being shown? Sounds unlikely on the face of it. Have you come across something that would support this?
Dec
12
comment Next value for Sequence Function
4 seconds faster!
Dec
11
comment Update statement is giving an invalid column name error, even though the column exists
So what is the output of SELECT @@VERSION?
Dec
11
comment Is there a SELECT statement to subtract rows of the same column?
@Falco - Possibly. Both permutations have been mentioned by the OP on this page. Without non obfuscated example dummy data and desired results for that data difficult to know what they want...
Dec
11
comment Is there a SELECT statement to subtract rows of the same column?
@LisaChise can you add some rows of example data to your question along with expected results for that data?
Dec
11
comment Update statement is giving an invalid column name error, even though the column exists
The only way I can see this happening at execution time is if you are creating a temp table of the same name outside the stored procedure. Example sqlfiddle.com/#!6/e937d/1
Dec
10
comment Update statement is giving an invalid column name error, even though the column exists
Correct answer to what? You still haven't provided an example of this happening. I copy and paste the code that you have provided into a SQL Fiddle and it works fine. sqlfiddle.com/#!6/80711/1
Dec
10
comment Incorrect query results for execution plan, unsure of exact cause of problem
Looks like I didn't recall correctly
Dec
10
comment Incorrect query results for execution plan, unsure of exact cause of problem
@DanRoberts the top is superfluous anyway as you have the filter on row_number. IIRC SQL Server does have logic to realise that no rows after 25 will contribute to the result so it won't carry on processing additional ones.
Dec
10
comment Incorrect query results for execution plan, unsure of exact cause of problem
What's the query? What do you order by to get the "first" page of results?
Dec
9
comment Update statement is giving an invalid column name error, even though the column exists
Except if you have a temp table with the same name in a different scope (higher up the call stack) you might get this I suppose. Or maybe if you are on an ancient version such as 2000.
Dec
9
comment Update statement is giving an invalid column name error, even though the column exists
When ran inside a stored procedure that code shouldn't throw that error. The table doesn't exist at first so all referencing statements should be subject to deferred compile. Please provide a full example that reproduces the issue.
Dec
8
comment Query to convert the count to million or thousands
Presumably the second /1000 should be dividing by a million. Also 1000000 falls through to the else in error.