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 2008 Forums
 Transact-SQL (2008)
 define table as
 New Topic  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  
 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