Viewing 15 posts - 106 through 120 (of 5,503 total)
New_2SQL (8/10/2014)
Hi Jeff Moden,This was a test run on about 88 rows as you can see in the source code posted above.
During production rows will grow in millions.
If production conditions...
August 11, 2014 at 2:15 am
One way to assign more than one value to a variable is to use a table variable.
But the major issue with your code is slightly different: you're using the very...
August 10, 2014 at 2:30 pm
Is it as annoying for you as it is for me to see all those spam posts?
Today (Sunday, August 10th), 22 out of 36 posts were plain spam. All from...
August 10, 2014 at 1:39 pm
Both of your SLEECT statements between parenthesis ar missing the table alias at the end.
E.g.
SELECT @EMP_ID = ID FROM (SELECT ID, ROW_NUMBER() OVER (ORDER BY ID ASC) ROW_NUM FROM dbO.TD_EmployeeProfile_FinalV2)...
August 10, 2014 at 12:41 pm
You can't reference a table with a variable unless you use dynamic SQL.
SELECT EMAIL_ADDR, ID FROM (@TABLE_NAME) won't work.
Since the value dbO.TD_EmployeeProfile_FinalV2 is assigned directly, whydon't you use it in...
August 10, 2014 at 11:53 am
Here's a slightly different approach:
create table #x (col1 int)
insert into #x
values
(202),(203),(204),(205),(209),(210),(211),(309),
(310),(311),(312),(313),(314);
WITH cte as
(
SELECT col1, ROW_NUMBER() OVER (ORDER BY col1) as id, col1 - ROW_NUMBER() OVER (ORDER BY col1) as...
August 10, 2014 at 11:47 am
I would add a Conditions table with the columns Condition, Step, NextStep.
In that table I'd store all the options for a specific Condition.
For example, Condition "A" can go from Step...
August 10, 2014 at 10:39 am
Are the row count values in sys.partitions accurate in general or is there a SQL Server version where the data started being "reliable" rather than "approximate"?
August 10, 2014 at 10:32 am
GilaMonster (8/10/2014)
LutzM (8/10/2014)
Quote from BOL(SS2K14):rows (bigint): Indicates the approximate number of rows in this partition.
The value from sys.partitions is accurate, with the exception of a bug in SQL.
So, BOL is...
August 10, 2014 at 10:23 am
Quote from BOL(SS2K14):
rows (bigint): Indicates the approximate number of rows in this partition.
August 10, 2014 at 3:28 am
I'd like to change Eirikurs 2nd method just slightly to cover partitioned tables, too:
CREATE FUNCTION dbo.FN_COUNT_ROWS2
(
@TABLE_NAME NVARCHAR(128)
)
RETURNS TABLE
AS
RETURN
SELECT SUM(rows) AS ROW_COUNT FROM sys.partitions
WHERE object_id =...
August 10, 2014 at 2:54 am
I'd like to know about the concept of the app accessing data.
Is it through queries constructed at the app side? (including DML statements)?
Is there any "Wannabe-Converter" (like NHyperhate) involved?
How much...
August 9, 2014 at 1:06 pm
You've mentioned to expect between 10 and 50 rows as the result set.
However, the actual execution plan returned more than 280.000 rows.
Are those rows really returned?
Or is there usually a...
August 9, 2014 at 9:20 am
MERGE is overkill here, I'd say.
You could use something along those lines:
UPDATE TableB
SET Descr = ISNULL(TableA.Descr ,'NA'), Name = CASE WHEN TableA.id IS NULL THEN TableA.Name ELSE TableB.Name END
FROM TableB
LEFT...
August 9, 2014 at 5:49 am
The reason I'm asking is fairly simple:
Based on the estimated execution plan there's nothing to indicate the long duration.
A few things can still be improved:
It seems like there are a...
August 9, 2014 at 5:17 am
Viewing 15 posts - 106 through 120 (of 5,503 total)