View Creation

View Creation

Post by venka » Wed, 31 Oct 2001 19:09:53



Hi,
 Is it possible to create a view from tables in the different database using
T-SQL?if possible,
pls send the T-SQL statement.

Thanks in advance,
Venkat

 
 
 

View Creation

Post by oj » Wed, 31 Oct 2001 19:16:29


sure...

create view venkat
as
select royalty
from pubs..titles
union all
select orderid
from northwind..orders
go

select * from venkat
go
drop view venkat
go

-oj


Quote:> Hi,
>  Is it possible to create a view from tables in the different database
using
> T-SQL?if possible,
> pls send the T-SQL statement.

> Thanks in advance,
> Venkat


 
 
 

View Creation

Post by venka » Wed, 31 Oct 2001 19:22:02


Thanks OJ

> sure...

> create view venkat
> as
> select royalty
> from pubs..titles
> union all
> select orderid
> from northwind..orders
> go

> select * from venkat
> go
> drop view venkat
> go

> -oj



> > Hi,
> >  Is it possible to create a view from tables in the different database
> using
> > T-SQL?if possible,
> > pls send the T-SQL statement.

> > Thanks in advance,
> > Venkat

 
 
 

View Creation

Post by venka » Fri, 02 Nov 2001 14:53:16


Hi experts,
   I have to create a view from tables in different databases.
say,
     Databases :    DB1  DB2  DB3
     Tables    :    T1  T2  T3
     Rows      :    index1      index2          index3
    ID  ID
    Name  Name

Here i want to check whether index1 is equal to index2.Suppose if it is
equal,then i have to
retrieve the ID and Name to show in the view.This i have done using this
T-SQL
 use DB1
 if exists(select ID,Name from T1,DB2..T2 where T1.index1 = DB2..T2.index2)
 DROP VIEW view7
 GO
 create view view7 as select ID,Name from T1,DB2..T2 where T1.index1 =
DB2..T2.index2
 GO
But here i also have to check whether index1 is equal to index3,if it equals
then i have to update
in the view7 in the same ID and Name fields.I have tried using Many T-SQL
statements,but i can't
find the solution.

Thanks in advance,
venkat

 
 
 

1. View Creation Q

I have a stored procedure that accepts no parameters, I would like to create
a view that displays the execution results of that stored procedure.

I tried avoiding writing a stored procedure at all, and simply putting all
the SQL in the view. However, the stored procedure uses temporary tables.

I also tried doing something like this :

create view ViewName
as Exec SPName

but that didn't work either (I was just coming up with ideas - don't know if
that's even possible)

Any suggestions?

The reason this has to be a view is that my client is gonna use Excel (dunno
how) to open the view, and whatever they're using to do that won't work on
sprocs.

2. Help Please, Cursor Problem!

3. View Creation Using Access Data Project

4. Tools for debugging stored pocedures?

5. Permission on View creation

6. Writeback/Analysis Services Tutorial

7. Newbie Question on View creation

8. IIS FTP and SQL conflicts?

9. View creation -- duplicate column values

10. Dynamic view creation

11. View creation!!Please help!

12. PERL/DBI: Finding view creation info