SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Sql query please reply
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rajeshskpm
Starting Member

India
10 Posts

Posted - 01/30/2009 :  04:52:50  Show Profile  Reply with Quote
suppose one table named 'emp'.

what will be the opt of below query?

select 1,2 from emp order by 1

[1,2 are not table columns]



rajesh

Nageswar9
Aged Yak Warrior

India
600 Posts

Posted - 01/30/2009 :  04:56:18  Show Profile  Reply with Quote
by default it returns 1 and 2 values for table
Go to Top of Page

bklr
Flowing Fount of Yak Knowledge

India
1693 Posts

Posted - 01/30/2009 :  04:56:53  Show Profile  Reply with Quote
1,2 values
as how many rows in ur table that many rows u will get
Go to Top of Page

Nageswar9
Aged Yak Warrior

India
600 Posts

Posted - 01/30/2009 :  04:56:54  Show Profile  Reply with Quote
declare @temp table ( date datetime,price int )
insert into @temp
select '1/1/2009',10 union all
select '3/1/2009',15 union all
select '5/1/2009',20 union all
select '7/1/2009',25

select 1,2 from @temp
Go to Top of Page

bklr
Flowing Fount of Yak Knowledge

India
1693 Posts

Posted - 01/30/2009 :  05:12:44  Show Profile  Reply with Quote
wt is the use of giving dynamically 1,2 values from tablename
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

United Kingdom
3608 Posts

Posted - 01/30/2009 :  05:42:01  Show Profile  Reply with Quote
Laziness.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000