Viewing 15 posts - 961 through 975 (of 1,246 total)
Ed Wagner (12/4/2015)
WITH (INDEX (0), TABLOCK)
The INDEX(0) tells it to use the clustered index....
December 5, 2015 at 6:34 am
here's a different option...
IF OBJECT_ID('tempdb..#Dates', 'U') IS NOT NULL
DROP TABLE #Dates;
CREATE TABLE #Dates (
WeekendDate DATE
);
INSERT #Dates (WeekendDate) VALUES
('11/01/2015'),
('11/08/2015'),
('11/15/2015'),
('11/22/2015'),
('11/29/2015');
IF OBJECT_ID('tempdb..#Product', 'U') IS NOT NULL
DROP TABLE #Product;
CREATE TABLE #Product...
December 4, 2015 at 5:01 pm
try this...
IF OBJECT_ID('tempdb..#Dates', 'U') IS NOT NULL
DROP TABLE #Dates;
CREATE TABLE #Dates (
WeekendDate DATE
);
INSERT #Dates (WeekendDate) VALUES
('11/01/2015'),
('11/08/2015'),
('11/15/2015'),
('11/22/2015'),
('11/29/2015');
IF OBJECT_ID('tempdb..#Product', 'U') IS NOT NULL
DROP TABLE #Product;
CREATE TABLE #Product (
Product CHAR(1),
Location...
December 4, 2015 at 4:19 pm
Sergiy (11/30/2015)
Jason A. Long (11/30/2015)
The other, less attractive, options are to use either a cursor or while loop.
"Less attractive" is a questionable judgement. There were several tests here which proved...
November 30, 2015 at 1:12 am
siddharthak024 (11/29/2015)
My question is how to solve it, Please don't divert the issue. I have to use the non cte code in different places.
As Jeff alluded, this is one of...
November 30, 2015 at 12:09 am
siddharthak024 (11/25/2015)
with cte1(id) as
{
select query ..............
union all
select query.............
join some query ................
join cte1 on some query
}
how to replicate this logic into normal sql query
I would really appreciate if...
November 25, 2015 at 4:36 pm
If you're actually on SQL 2012, you should be able to get better performance by using the LEAD windowed function rather than a self join.
Both versions produce the same...
November 24, 2015 at 8:43 pm
This should give you what you're looking for...
-- your original test data --
IF OBJECT_ID('tempdb..#t','U') IS NOT NULL
DROP TABLE #t;
CREATE TABLE #t (id INT NOT NULL ,col1 DECIMAL(18,2) NOT NULL );
...
November 23, 2015 at 8:29 pm
A reprieve... Just had a conversation with the SVP in charge of the project...
In the end we both agreed that the specific exception can change from contract version to contract...
November 19, 2015 at 11:20 am
drew.allen (11/19/2015)
November 19, 2015 at 11:04 am
RonKyle (11/19/2015)
It violates Second Normal Form in that the foreign key is NOT dependent on the whole of the primary key. The fact that you had to specify IGNORE_DUP_KEY in...
November 19, 2015 at 10:40 am
drew.allen (11/19/2015)
It violates Second Normal Form in that the foreign key is NOT dependent on the whole of the primary key. The fact that you had to specify IGNORE_DUP_KEY...
November 19, 2015 at 10:26 am
drew.allen (11/19/2015)
Jason A. Long (11/19/2015)
drew.allen (11/19/2015)
November 19, 2015 at 9:27 am
drew.allen (11/19/2015)
November 19, 2015 at 8:11 am
Sean Lange (11/19/2015)
RonKyle (11/19/2015)
November 19, 2015 at 8:06 am
Viewing 15 posts - 961 through 975 (of 1,246 total)