Author |
Topic |
palaparu
Starting Member
20 Posts |
Posted - 2010-10-27 : 12:23:43
|
How to create a view of table with few columns,taking only 5 coulmns out of 10 columns |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-10-27 : 12:27:44
|
CREATE VIEW viewname_hereASSELECTcolumn1,column3,column5,column7,column9FROM YourTable No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
palaparu
Starting Member
20 Posts |
Posted - 2010-10-27 : 13:39:15
|
thanx dude.. |
 |
|
palaparu
Starting Member
20 Posts |
Posted - 2010-10-27 : 13:40:09
|
but how to create a view of few columns in a table... which is present in the other database |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-10-27 : 14:20:11
|
quote: Originally posted by palaparu but how to create a view of few columns in a table... which is present in the other database
same as what webfred showed with small addition as belowCREATE VIEW viewname_hereASSELECTcolumn1,column3,column5,column7,column9FROM DBName.SchemaName.YourTable provided dbs are in same server------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
palaparu
Starting Member
20 Posts |
Posted - 2010-10-27 : 14:32:48
|
Hi visakh, I appreciate ur answer.....But i need to create a view with 5 columns in one table and 5 columns from other tabletotally the create view must have 10 columns |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-10-27 : 14:36:25
|
show the structure of two tables and then eplain which all columns you want in the view------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
palaparu
Starting Member
20 Posts |
Posted - 2010-10-27 : 14:50:53
|
there are two tables 1. Hyderabad 2. Atlanta1. Hyderabad has columns like a,b,c,d2. Atlanta has columns like e,f,g,hNow i want to create a view with columns b,c,f,g |
 |
|
palaparu
Starting Member
20 Posts |
Posted - 2010-10-27 : 14:53:24
|
CREATE VIEW vizag AS SELECT b,c from Hyderabad thenhow to add f,g columns from ATLANTA Table in that query to get b,c,f,g in one view |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-10-27 : 14:56:29
|
then you need to have some columns by which you can relate between two tables. how are they related?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
palaparu
Starting Member
20 Posts |
Posted - 2010-10-27 : 14:58:22
|
how r they related ante ela chepali boss.... |
 |
|
palaparu
Starting Member
20 Posts |
Posted - 2010-10-27 : 15:06:56
|
number ivvandi okasari call chesta |
 |
|
|