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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

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

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 define table as
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jasmen
Starting Member

11 Posts

Posted - 02/25/2014 :  07:07:08  Show Profile  Reply with Quote
i have table
i want to define it as letter for example e
so i can write in stored procedure
e.tables columns
example
e.empno

RonnieRahman
Starting Member

United Kingdom
6 Posts

Posted - 02/25/2014 :  07:37:33  Show Profile  Reply with Quote
Hiya

Did you mean Table alias?

Table Alias sample code below:


SELECT 
		a.column1,
		a.column2
FROM myTable a
Where a.column1=1
GROUP BY
		a.column1,
		a.column2

Go to Top of Page

jasmen
Starting Member

11 Posts

Posted - 02/25/2014 :  07:40:26  Show Profile  Reply with Quote

i mean like this
select e.empno,e.firstname,e.lastname,e.contactno,p.policyid,p.policyname,p.policyamount,p.companyname
from empregister e inner join policiesonemployees p on e.empno=p.empno where e.designation=@desig
RETURN
e and p are tables
how can define them as e or p

Edited by - jasmen on 02/25/2014 07:46:48
Go to Top of Page

Lamprey
Flowing Fount of Yak Knowledge

4614 Posts

Posted - 02/25/2014 :  13:08:27  Show Profile  Reply with Quote
quote:
Originally posted by jasmen


i mean like this
select e.empno,e.firstname,e.lastname,e.contactno,p.policyid,p.policyname,p.policyamount,p.companyname
from empregister e inner join policiesonemployees p on e.empno=p.empno where e.designation=@desig
RETURN
e and p are tables
how can define them as e or p

You already did. The "proper" way is to use the AS operator:
from empregister AS e inner join policiesonemployees AS p
Go to Top of Page
  Previous Topic Topic Next 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.03 seconds. Powered By: Snitz Forums 2000