Viewing 15 posts - 901 through 915 (of 1,228 total)
This...
SET ROWCOUNT 2;
INSERT INTO #Test_Rowcount (Value)
SELECT TOP 4 * FROM (
SELECT 'One' V UNION ALL ...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 21, 2011 at 11:09 am
Hi Martin, sorry for not making it sufficiently clear. What I'm after is data in both tables, and your query, to replicate your findings. So...
INSERT INTO Company ([columnlist]) VALUES ([Valuelist])
INSERT...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 21, 2011 at 9:38 am
-- Correct result, dodgy logic
(SELECT *
FROM #TABLE1
EXCEPT
SELECT * FROM #TABLE2)
UNION ALL
(SELECT *
FROM #TABLE2
EXCEPT
SELECT * FROM #TABLE1)
-- correct result, correct logic
SELECT t1.*
FROM #TABLE1 t1
WHERE EXISTS (
SELECT 1...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 21, 2011 at 7:46 am
Dorian Gray (4/21/2011)
ps: Sorry - couldn't resist. I'd say go with your gut instinct. Typically...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 21, 2011 at 6:30 am
You will get a wide range of responses from folks who've been in this position. Here's my experience, from being there twice in 20 years of contracting.
If you don't mind...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 21, 2011 at 5:55 am
v-anand (4/21/2011)
I need to create a temporary table so as to do some calculation.
For example there is a table named Product having columns -ProductID, ProductName, Price and there is...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 21, 2011 at 4:42 am
Also, INSERT statements to create data in both tables which will generate this result:
CompanyName StreetNumber StreeName StreetType Suburb Postcode State
123 Acc Brisbane 4000 QLD
123 Acc 123 Pitt Street Brisbane 4000...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 21, 2011 at 3:48 am
ananda.murugesan (4/21/2011)
In SQL SERVER 2000.
Blocked process not clear after restarting SQL SERVICES, please tell me what could be reason? once restart the service all transaction will be terminated...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 21, 2011 at 3:44 am
Dynamic SQL isn't necessary:
ALTER PROCEDURE dbo.MyTest
AS
SELECT TOP 10 [name] FROM sys.columns ORDER BY [name]
RETURN 0
GO
CREATE TABLE #ColumnNames ([name] VARCHAR(200))
INSERT INTO #ColumnNames ([name]) EXEC dbo.MyTest
SELECT * FROM #ColumnNames
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 21, 2011 at 3:34 am
David Burrows (4/21/2011)
Jeff Moden (4/20/2011)
If we don't know the length, then we can force the max length for positive BIGINTs and simply remove all spaces afterwards.
Also if you append the...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 21, 2011 at 3:24 am
Hi Ananda
Your first point - rewriting the code - if the code you posted is a representative sample then I'd agree. Find the worst-performing code and begin there. Grant Fritchey...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 21, 2011 at 3:19 am
Hi Ananda
Let's have a closer look at that stored procedure. It's a series of DELETE/INSERT statements separated by conditionals - depending on what's already in the db, one of them...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 21, 2011 at 2:19 am
Hi Martin
Please can you post CREATE TABLE statements for both tables. Some sample data for each would be awesome. Also, the simple query which returns:
CompanyName, StreetNumber, StreeName, StreetType, Suburb, Postcode,...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 21, 2011 at 12:31 am
Michael Valentine Jones (4/20/2011)
ChrisM@home (4/20/2011)
...
@michael-2 - I can't believe you posted that!
I'm just hoping to see someone use it in production code. :satisfied:
Actually, I started wondering if a function...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 21, 2011 at 12:01 am
david.holley (4/20/2011)
So check to see if the returned value is null and if it is return the lower boundary date?
Exactly. Your app will have to check the value is or...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 20, 2011 at 3:12 pm
Viewing 15 posts - 901 through 915 (of 1,228 total)