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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Openrowset Views

Author  Topic 

Kyriakos
Starting Member

13 Posts

Posted - 2007-11-30 : 07:42:46
Hi I have a table like:

LIB TABLENAME TABLEDESCR FIELDNAME FIELDDESCR
BISxxSET ALPA0A sometable BS12A0 somefield
BISxxSET ALPA0A sometable PERCA0 somotherfield
BISxxSET ALPA1A someothertable CMPNA1 somefield2
BISxxSET ALPA1A someothertable MERIA1 someotherfield2
BISFFBUA ALPA1A anothertable PAARS somefield3

and would like to create views for each distinct table, using openrowset.
An added complexity is that the library name depends on the company code (i.e. BISxxSET.ALPA0A turns to BIS03SET.ALPA0A for company 03 whereas BSFFBUA.ALPA1A remains intact).

Thanks in advance

Kyriakos

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-12-02 : 00:18:12
Why create views using openrowset? The table is on remote sql server?
Go to Top of Page

Kyriakos
Starting Member

13 Posts

Posted - 2007-12-03 : 02:52:49
Yes the table is on a remote server - DB2 server actually.
Go to Top of Page

Kyriakos
Starting Member

13 Posts

Posted - 2007-12-04 : 07:50:05
Could I use variable name when creating the view?
Is CREATE VIEW @VAR1 acceptable?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-04 : 07:56:17
quote:
Originally posted by Kyriakos

Could I use variable name when creating the view?
Is CREATE VIEW @VAR1 acceptable?


Not possible until you use Dynamic sql
Read about Linked Server in sql server help file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -