Solved

sql 2008 create view b using linkes server

Posted on 2011-09-16
7
350 Views
Last Modified: 2012-05-12
CREATE VIEW [dbo].[apple]
as
    select
        xx.ProdNo as productNo,
        xx.Descr as Descr
   from server.Mydatabase.dbo.AllProd xx
    COLLATE Danish_Norwegian_CI_AS ASC;
GO
I get the following error "Incorrect syntax near the keyword 'COLLATE'."

Create view thru a LINKED SERVER
0
Comment
Question by:shanj
  • 3
  • 3
7 Comments
 
LVL 6

Expert Comment

by:dan_mason
ID: 36548603
What about this?
CREATE VIEW [dbo].[apple] 
as
    SELECT
        xx.ProdNo as productNo COLLATE Danish_Norwegian_CI_AS,
        xx.Descr as Descr COLLATE Danish_Norwegian_CI_AS
   FROM server.Mydatabase.dbo.AllProd xx
 GO

Open in new window

0
 
LVL 6

Expert Comment

by:dan_mason
ID: 36548719
The setting up a linked server is not too hard, by the way. Using SQL Server Management Studio, in the Object Explorer, right-click Server Objects, select New, and select Linked Server. The boxes are fairly self-explanatory hopefully, but let us know if you need further advice.
0
 

Author Comment

by:shanj
ID: 36548882
hi dan!
  problem is not linked servers.
i want to create a view with collation via a linked server is the problem.
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:shanj
ID: 36548915
dan the create view gave me the same error-.
Incorrect syntax near the keyword 'COLLATE'.
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 36549005
what about:
CREATE VIEW [dbo].[apple] 
as
    SELECT
        xx.ProdNo COLLATE Danish_Norwegian_CI_AS as productNo ,
        xx.Descr COLLATE Danish_Norwegian_CI_AS as Descr 
   FROM server.Mydatabase.dbo.AllProd xx
 GO

Open in new window

0
 
LVL 6

Expert Comment

by:dan_mason
ID: 36549115
Yep, thanks angelIII : precisely what I meant to write! Stupidly I didn't spot the "as" in the code.
0
 

Author Closing Comment

by:shanj
ID: 36553686
thanks angelll  it worked
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question