.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Create view that amins to tables of another database on the same sql server instance

Posted By:      Posted Date: September 09, 2010    Points: 0   Category :Sql Server
Hi to everybody, I found a situation ever met before. I develop on Dynamics NAV 5.01 and I have developed a method to be able to see some particular tables of an external database. In substance it deals with a property of tables of Dynamics NAV. When I create a table in NAV, I can create it in 3 different ways: table common to all the companies table  for company or table linked to a view.    This last case is mine, on the same db of NAV I have created a view with some fields, I have created in NAV a table linked with equal fields and types. Until here all normal.    The view, however, aims to another database that doesn't center anything with NAV but that it is on the same intance of SQL server.    The consumer that accesses NAV is a consumer type database SQL Server and has the permitted db_public and db_datareader on both the database. Then he can read the views on the db of nav both on the db of the other database.    When it tries to enter from the console of sql server, with the consumer database, all it works, if I do it by NAV, it show me an error "The server principal "username" is not able to access the database "some_database_name" under the current security context. (Microsoft SQL Server, Error: 916) "    If I add on the database NAV to the consumer, the role db_owner,

View Complete Post

More Related Resource Links

How to create a view in my database from a table in another server/database

Is there a way to create a view in my database referencing a table in another server/database if I have the connection information.  I know how to do it in Oracle, simply create a database link, but have never done so in sqlserver.

Connestion string create any database server

This links important to how to create connection string to any data base sever.

Metadata: Create a Database Schema Repository with Meta Data Services in SQL Server 2000


SQL Server 2000 Meta Data Services is a repository technology that stores and manages metadata for SQL Server. Instead of building database schemas over and over, Meta Data Services allows you to freeze an entire schema for use in other projects. You can also use these schemas for training, testing, or debugging. In this article, the authors will review the various components of Meta Data Services and show how it can be programmed using a Visual Basic client, XML, and XSLT. They will also show you how to manage and manipulate your metadata by generating a simple database schema using a SQL Server repository.

Alok Mehta and Ricardo Rodriguez

MSDN Magazine May 2003

Windows 7 CREATE DATABASE permission denied in database 'master'. (Microsoft SQL Server, Error: 26

Hi I have migrated to a new computer using Windows 7, 6 gig memory, I7 chip (old machine had xp) and have installed Visual Studio 2008 and  SQL Server 2008 R2.  I get CREATE DATABASE permission denied in database 'master'. (Microsoft SQL Server, Error: 262) when I try to create a new database.  Other posts (example:http://social.msdn.microsoft.com/forums/en-US/sqltools/thread/28fee0ed-c7e2-40df-8f79-f513c9848f09/) work for Vista but I cannot find how to grant permissions.  Run as administrator (vista fix) does not work. I have admin privaleges on my machine.  There are no other accounts.    What do I need to do to update privaleges? Thanks and have a nice day.    

Cannot Create Database Diagrams - SQL Server 2008 Management Studio

I cannot create a database diagram with my client-side SQL Server Management Studio.  I can do this if I am on the actual db server itself.  Please help.

Create new database as a user instance

Hello...Is there any way to create a new database directly as a user instance. I guess this means creating a new mdf/ldf pair which is detached from the server after its created.Thank you...

please help me to create database in sql server 2008

hi,    i am new to asp.net. i like to learn asp.net and c#. when i try to connect to sql server, it asks server name. i don't know server name and it asks database name also. how to create database and where can i access like phpmyadmin. in phpmyadmin i can create database and tables. i am new to this. please help me.thanks.  

How to create a SSIS package to import records form SQl Server 2008 tables to text files

I am a newbie to SSIS and would like to create a package to accomplish the task referenced in the above title. Will appreciate any links and pointers in the right direction.   Thanksakoranteng

Cannot create instance of "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" on x64 Vista with x6

I am attempting to take data from an Excel 2007 spreadsheet and use OpenDataSource to throw the data into a SQL Server 2008 SP1 table under an x64 OS and x64 SQL Server.  I was able to get this to work under x86 versions of the OS and SQL by setting sp_MSset_oledb_prop with values of AllowInProcess and DynamicParameters to 1.  However, under x64 SQL 2008, when I set the AllowInProcess option to 1, I get the following error:  "OLEDB provider "Microsoft.ACE.OLEDB.12.0" cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode."  If I turn this flag off, I receive the error shown above in the title.I saw suggestions about creating a .Net program and then forcing it to target an x86 processor, but this method did not work either.  I also saw suggestions about installing the 2007 Data Access drivers, and although I believe they already were installed, I installed them specifically, but it changed nothing.  I also tried remotely accessing the x64 system from an x86 environment, but it also changed nothing.Therefore, I cannot get the OpenDataSource method to work from Mgmt Studio or from an x86 program, so I would appreciate insights into how someone is supposed to be able to retrieve data from an Excel 2007 workbook in an x64 environment.  I find it hard to believe that with numerous servers running on x64 t

Cannot create an instance of OLE DB provider "IBMDADB2" for linked server

System:  Win 2003, SQL Server 2005, Using an AD win account that is not a member of the Admin group on the server.   Error message from Management Studio query window:   Msg 7302, Level 16, State 1, Line 1 Cannot create an instance of OLE DB provider "IBMDADB2" for linked server "Sname".   Event messages associated with this error:   App Event ID: 19036 The OLE DB initialization service failed to load. Reinstall Microsoft Data Access Components. If the problem persists, contact product support for the OLEDB provider.   Sys Event ID: 10016 The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID {2206CDB0-19C1-11D1-89E0-00C04FD7A829}  to the user domain\user SID (S-1-5-21-126051702-1034962659-2130403006-7826).  This security permission can be modified using the Component Services administrative tool.   I'm getting this error message when trying to run an openquery statement through a linked server to DB2. (SELECT * FROM OPENQUERY(Sname, 'SELECT * FROM tablename')) The linked server has a remote login and password that it uses to connect to DB2.   I found this from another post on how to fix this error: Expand Component Services - Computers - My Computer - DCOM Config Select MSDAINITIALIZE Right Click properties then security Under Security - Launch Permission: enable Local Launch and L

Create new instance of sql 2008 R2 server

Is there a way to create a instace of sql server just using my pc name? Currently sql uses 'machine name\instance name'

how to create database tree view using jquery


how to create database tree view using jquery

SQL Server 2K5 - C# Create database - Catch error



    using (SqlConnection sqlConnection = new SqlConnection("Data Source=" + session["DWSERVER"] + ";Initial Catalog=master;Integrated Security=SSPI;"))


     ServerConnection svrConnection = new ServerConnection(sqlConnection);

     Server server = new Server(svrConnection);

     string script = File.ReadAllText(session["INSTALLLOCATION"] + @"Sources\DW.sql");

     script = script.Replace("[SSASSERVER]", session["SSASSERVER"]);

     script = script.Replace("[DWSERVER]", session["DWSERVER"]);

     script = script.Replace("[DBSERVER]", session["DBSERVER"]);

     script = script.Replace(&q

Microsoft SQL Server Management Studio 2008 does not list all tables in database

When logging into SSMS 2008 to a SQL2008 database when I expand the tables in a database I only see a few tables listed.  I can login to the same instance with SSMS 2005 and all of the tables are there.  Is there a reason why this is this way?

I can do a select * from in a query window for any of the tables in the database via SSMS 2008 as well and it work fine.  It just does not display the tables.

Create database permision denied in database ' master' (MS SQL SERVER, ERROR 262


Cn not do anything with my sql server, everything i trt to do i get this message, user does not have permision, etc, ,

I am running windows Vista Business, SQL SERVER 2005

so what going on here


Cannot create database diagrams for sqlexpress .mdf file in Visual studio server explorer



I've look around the forums but I can't get the solution for my problem. I've installed Visual studio 2010 with sqlexpress edition. Then I have renamed my computer. After renaming my computer I've deleted the directory C:\Users\uporabnik\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS. After restart, I have started VS2010, open Server explorer and I've added the connection to a new database. I've been able to add new tabels, bu when I've tried to add a diagram, it didn't work. In properties window od the database I saw, the the database owner was oldComputerName\username not newComputerName\userName. In sql server management studio I've reanmed the user oldComputerName\userName to newComputerName\userName. After attaching the database it worked fine.

I've returned to Visual studio 2010. When creating new database, the owner of new database is oldComputerName\userName. The next tip was renaming the  SQLServerMSSQLUser$ComputerName$SQLEXPRESS(and other names with sql...) in Local Users and gorups in Mange My computer. After restarting the compter I've got the same result. When creating new .mdf file in server explorer of visual studio, the database owner is oldComputerName\userName.<

Can instance(s) access database(s) not on there instance in sql server


I've only seen instance(s) access databases on that instance. Can multiple instances access databases on other instances, in the old versions or in R2 of sql server?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend