rookie question

rookie question

Post by Lisa Pearlso » Fri, 06 Apr 2001 04:44:26




What's the difference between

and

Or

and

What's the difference between SELECT and SET when you're assigning a value
to a variable?
(Any difference in performance?)

Lisa

 
 
 

rookie question

Post by Sara » Fri, 06 Apr 2001 05:10:20


Nope.

Sara.

 
 
 

rookie question

Post by Andrew J. Kell » Fri, 06 Apr 2001 05:14:22


This is the way I look at it. SELECT is overused (does too much in my
opinion) so if nothing else, SET is easier to read and tell what your really
doing. Any time I want to assign a value to a variable (outside of a sql
statement) I use SET. I don't know for sure but I believe SET is also the
ANSI99 way to do things but I don't have a copy handy to verify that. The
only issue with using SET over SELECT to assign a value to a variable that I

together.



In my opinion this is an oversight or slight bug and they should behave the
same.
I am not aware of any performance difference either way.

--
Andrew J. Kelly
Targitmail.com



> What's the difference between

> and

> Or

> and

> What's the difference between SELECT and SET when you're assigning a value
> to a variable?
> (Any difference in performance?)

> Lisa

 
 
 

rookie question

Post by Meade Robbo » Fri, 06 Apr 2001 06:37:49


Lisa,

SET only works for local variables (and does some stuff with cursors as
well)
SET only works on a single variable / value

If you need to go beyond these restrictions, you need to use the SELECT
statement.


-Meade



> What's the difference between

> and

> Or

> and

> What's the difference between SELECT and SET when you're assigning a value
> to a variable?
> (Any difference in performance?)

> Lisa

 
 
 

rookie question

Post by Tibor Karasz » Fri, 06 Apr 2001 18:27:56


Lisa,

In addition to the other posts:

SET is ANSI SQL-92 and -99 compliant, SELECT is not (for variable assignment, of
course). Use SET for variable assignment! SET is also easier to read and understand.
I've done some tests (loops) and found no performance difference.

SET was introduced in 7.0, so before that we had no choice.

(Btw, you might want to indicate in subject what post is about. Makes it easier to
browse though these groups :-)
--
Tibor Karaszi, SQL Server MVP
FAQ from Neil at: http://www.sqlserverfaq.com
Please reply to the newsgroup only, not by email.



> What's the difference between

> and

> Or

> and

> What's the difference between SELECT and SET when you're assigning a value
> to a variable?
> (Any difference in performance?)

> Lisa

 
 
 

1. rookie question re: TNS/LISTENER

I have Oracle 8i on Linux on a stand-alone PC.
On this pc I have a starter database called "oralin".
Having got the databse up and running, I enter a command from the shell:

resolve service name.
The details from the initialization file, initoralin.ora are:

db_name = "oralin"
db_domain = localhost.com

instance_name = oralin
service_names=oralin.localhost.com

I don't know why this command does not work but I have my L-plates on.
Thanks in advance.

2. searching Beta-Testers for Personal OLAP Product

3. rookie question about stored procedures

4. White Screen when running Paradox 7 under Win NT 4.0

5. rookie question - ref. sp_MSins

6. SQL-DMO with MFC

7. BIG ROOKIE QUESTION

8. No Redraw after Escape Key

9. rookie questions <cont>

10. rookie question: update sets all but where condition data to null

11. Rookie Question: Reporting in VB

12. A Big Time Rookie Question

13. Rookie Question: Trusted Connection?