Rx_
Nothing In Moderation
- Local time
- Today, 00:40
- Joined
- Oct 22, 2009
- Messages
- 2,803
Wondering if someone has an idea why one method of creating a view in SQL Server works, and the other one doesn't.
Background: A Linked Server to an Oracle DB in SQL Server provides tables to MS SQL Server Management Studio view.
Go to the Linked Server, choose a table, right-click, in menu- Script As - choose Select To New Query Window.
This SQL Select query can be executed:
Method One: New View
1. In Views - Create View - Past in the SQL Statement above minus the GO statement
2. Error near From clause. Note: the [V2.EGG.COM] parens go away - Add them back - error: ... contains more than the maximum number of prefixes. The Maximum is 3.
3. The attempt to execute - removes the [ ] around the [V2.EGG.COM]
So: the editor doesn't like the V2.EGG.COM
Method Two: Create Script
This one works great!
Just wondering if there is any way to run the first method in Create View?
Background: A Linked Server to an Oracle DB in SQL Server provides tables to MS SQL Server Management Studio view.
Go to the Linked Server, choose a table, right-click, in menu- Script As - choose Select To New Query Window.
This SQL Select query can be executed:
Code:
SELECT top 100 [AFE_ID]
FROM [V2.EGG.COM]..[NAV_DBA].[NV_WELL_AFE]
GO
1. In Views - Create View - Past in the SQL Statement above minus the GO statement
2. Error near From clause. Note: the [V2.EGG.COM] parens go away - Add them back - error: ... contains more than the maximum number of prefixes. The Maximum is 3.
3. The attempt to execute - removes the [ ] around the [V2.EGG.COM]
So: the editor doesn't like the V2.EGG.COM
Method Two: Create Script
Code:
[SIZE=3][FONT=Times New Roman]USE [ProductionDB][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]GO[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]SET ANSI_NULLS ON[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]GO[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]use ProductionDB[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]SET QUOTED_IDENTIFIER ON[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]GO[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]CREATE VIEW [dbo].[VNav][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]AS[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]SELECT top 100 [AFE_ID][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] FROM [V2.EGG.COM]..[NAV_DBA].[NV_WELL_AFE][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]GO[/FONT][/SIZE]
Just wondering if there is any way to run the first method in Create View?