Viewing 15 posts - 856 through 870 (of 1,228 total)
Here's another version using APPLY without any sneaky tricks.
DROP table #orders
create table #orders(
oid int,
itemid int
)
insert into #orders (oid, itemid)
values (1,1111)
insert into #orders (oid, itemid)
values (1,2222)
insert into #orders (oid, itemid)
values (1,3333)
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]
May 3, 2011 at 7:59 am
IF / ELSE is conditional processing of statements, so CASE would better match your requirements.
You will need to provide a more complete explanation of conditions and outcomes for a...
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]
May 2, 2011 at 3:35 pm
virgilrucsandescu (5/2/2011)
Thank you, tt works just perfect!Excuse my ignorance, but what's a "Quirky Update" ?
Hi Virgil
This link[/url] will show you an alternative set-based method of calculating running totals and introduce...
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]
May 2, 2011 at 9:32 am
Koen Verbeeck (5/1/2011)
ChrisM@home (4/30/2011)
LutzM (4/30/2011)
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]
May 2, 2011 at 1:57 am
virgilrucsandescu (5/1/2011)
Performance is not an issue in this case, I am just curious if just a set based solution is possible for this
This is probably the simplest set-based solution. It's...
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]
May 2, 2011 at 1:51 am
ColdCoffee (5/1/2011)
Got it; Now, as Dixie says, either Quirky Update or Cursor can save you. I am still pondering if it will be possible by a Recursive-CTE..Got to think..
A recursive...
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]
May 2, 2011 at 1:26 am
Here's a solution right now. Never use code from a website without checking it first and fully understanding how it works - this article [/url]will explain the method used in...
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]
May 1, 2011 at 12:37 pm
Dave Ballantyne (4/30/2011)
Yes indeed. Then Monday is a bank holiday. Nice long weekend for them
Combined with the Easter Holiday last weekend as well, April is not going to be...
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 30, 2011 at 11:12 am
LutzM (4/30/2011)
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 30, 2011 at 11:10 am
OP appears to have lost interest :ermm:
There's a solution to this without using TOP or any aggregate functions: variable assignment.
This query
DECLARE @curr tinyint, @ddate smalldatetime, @rate decimal(15, 4)
SELECT @curr =...
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 30, 2011 at 2:43 am
In addition to the questions which Craig has asked, can you confirm which version of SQL Server you are using? This is the SQL Server 7, 2000 section.
Cheers.
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 28, 2011 at 1:59 pm
richard-674310 (4/28/2011)
... Is there some standard approach I am missing?
This has been discussed on the forum before, I'll try to find the thread.
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 28, 2011 at 3:37 am
If you have a sequential integer PK, then this is fast.
SELECT *
FROM TransactionDetail
WHERE TransactionDetailID = (SELECT ABS(CHECKSUM(NEWID()))%100000+1)
Replace 1000000 with the max ID in your table.
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 28, 2011 at 3:31 am
kuppurajm (4/27/2011)
Hi,How can I round the number and remove decimal palces in sql server in simple way?
EX:134.678
I need result like this 135
What result do you expect from 134.478?
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 28, 2011 at 12:04 am
Faye Fouladi (4/27/2011)
thank you. Can you please tell me which string is bound by an extra quote?
AND ca_d.name in (''AHLTA','Attachmate Reflection CHCS Companion with Public Keys',
'Essentris','Dragon NaturallySpeaking','Nuance PDF...
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 27, 2011 at 11:36 am
Viewing 15 posts - 856 through 870 (of 1,228 total)