Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Numbers in SQL query

Author  Topic 

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2006-06-20 : 03:35:24
why we use there query?

select 0 <zero> from <table name>

0 - zero

BMahesh

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-06-20 : 03:38:45
i don't, it just returns the value 0 for all rows in the the table
if you're using it, ask the DBA or developer who used it

--------------------
keeping it simple...
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-06-20 : 03:41:38
No idea.

- Maybe check for existance of table (but there are better way to do this) ?
- Or Maybe by the number of rows return determine number of records (select count(*) from table will be more efficient) ?

Ask the programmer !


KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-06-28 : 06:58:05
quote:
Originally posted by mahesh_bote

why we use there query?

select 0 <zero> from <table name>

0 - zero

BMahesh


Usually this is used to check if row exists in a table without worry about actual data. It can be also used as

If exists(Select 0...)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

KenW
Constraint Violating Yak Guru

391 Posts

Posted - 2006-06-28 : 14:55:43
At a company I used to work for, the first interview question for someone claiming knowledge of Oracle SQL was:

"What's the result of the query
'SELECT 'A' from dual' ?"

If they couldn't answer, the interview was over. :-)

Ken
Go to Top of Page
   

- Advertisement -