Re: What does it mean to SET a value?
- From: Ed Murphy <emurphy42@xxxxxxxxxxxx>
- Date: Wed, 02 Apr 2008 20:16:38 -0700
steve wrote:
What does it mean to set a value or April fools all year long :)
http://beyondsql.blogspot.com/2008/03/sql-what-does-it-mean-to-set-value.html
The relevant portion of this article appears to be the following:
In Sql when there are multiple rows that satisfy a
a WHERE clause the variable is left undefined and an error generated:
DECLARE @MyFrt MONEY;
SET @MyFrt = (SELECT Freight FROM Orders WHERE OrderID<=10249);
-- Subquery returned more than 1 value. This is not permitted when the subquery follows
-- =, !=, <, <= , >, >= or when the subquery is used as an expression.
This is really a valid logical operation, an attempt to set (assign) a table to a variable.
This is precisely what D4 does:
var MyFrt:=Orders where OrderID<=10249 {Freight};
select MyFrt;
Freight //A table.
-------
$11.61
$32.38
select MyFrt is table{Freight:Money};//Returns True confirming MyFrt is a table type.
But why not simply use a temporary table?
select Freight into #MyFrtTable from Orders where OrderID <= 10249
Your previous line of argument (explicit table-valued procedure
parameters, replacing implicit temp-table input/output and/or
SELECT/FROM-based output) was more compelling; my objection to it
was limited to D4 being an utter non-starter for the large number
of existing systems already implemented in SQL. This line of
argument, while understandable in principle, is less of a big deal.
.
- Follow-Ups:
- Re: What does it mean to SET a value?
- From: steve
- Re: What does it mean to SET a value?
- References:
- What does it mean to SET a value?
- From: steve
- What does it mean to SET a value?
- Prev by Date: Re: An optimum query..?
- Next by Date: Re: SQL Assistance required
- Previous by thread: What does it mean to SET a value?
- Next by thread: Re: What does it mean to SET a value?
- Index(es):