I'm trying to use Linq to run queries against a linked server on our SQL Server machine through Visual Studio.
On the SQL Server, I've successfully created the linked server and can run queries on it. In Visual Studio I've added a new data connection (under Server Explorer) to the SQL Server with success but the linked server tables are not available.
How can I get the linked server tables to show up? Or can I even do this?
I usually create a view in a local database for each table I access through a linked server. That allows me to change the links as needed without having to change any SQL. And you should be able to use the view in LINQ to SQL without issue.
Related
The questions is basically the title because I could not find any articles to help as they only help on how to create a new database however I cant seem to create/join my own server.
The first picture attached is what I've seen other people do in order to get in however, I get an error when i try to connect
SQL Server and SSMS are two seperate softwares. SQL Server creates a database engine on your machine and SSMS is used to visualize or perform operations on these Database Servers. You Need to install both SQL Server and SSMS. While you seem to have install only SSMS.
You Can Install SQL Server from this link
SQL Server Download
You can follow this link to SQL Server Installation Tutorial
You can "explore" the schema etc. using the SQL Server Object Explorer in VS.
However, I can't find a way to view the data in a given table (at least the first page), or to run some arbitrary SQL.
Is this possible?
I also have the full blown Microsoft SQL Server Manager installed, but this can't "see" the databases created by Visual Studio in its built-in SQL Server Express instance. It can only connect to its own full blown SQL Server databases.
I have looked for a tool to view data in SQL Server Express, but have not found anything yet. There does not seem to be a version of Microsoft SQL Server Manager for SQL Server Express unfortunately.
You can do a "New Query" on any database node to run a query window:
And then you can do a "View Data" on any table, in SQL Server Object Explorer:
But you should also be able to load any "LocalDB" instance and view it from the full-fledged SQL Server Management Studio (at least since SSMS v17, where it's a separate, free download)....
There's an Umbraco site that various people been contributing content to. It runs on a hosted domain using a SQL Server Compact edition database for the CMS. It's about to go live and I need to sync the dev database to the live SQL Server instance which is hosted by a third party.
I just ass(u)me(d) that I could attach the .sdf to my local SQL Server and use a commercial tool (Redgate/SQLDelta etc.) to copy it to the live db. This does not seem to be possible. While I have managed to attach the .sdf using Linqpad, I can't connect to it like a regular database.
The best option seems to be to script out the entire database, but this seems like an impossible task using just Linqpad (no flies on Linqpad, obviously - it isn't the tool for such a task). Any less onerous options would be gratefully accepted.
You can use my free "SQL Server Compact Toolbox" Visual Studio extension for this. It can generate a script of the entire SQL Server Compact database, that you can then run against an empty SQL Server database.
In the past I did this kind of scenario wherein I need to copy the data from the SQL Server CE to a SQL Server database. Have you tried adding the .sdf to an ODBC then linked that ODBC to SQL Server?
When querying sql server view data (it does work when I query a table), I receive only the header but no rows. In sql server profiler I can see that the sql statement looks correct (and I get data from the view when I execute the statement in sql server management studio) but the read and cpu counters are minimal compared to a direct query. There are no linked servers involved, username in profiler is the same for both access methods.
One of the subviews was filtering using for APP_NAME()... which is "Microsoft Office 2013" when one queries from Excel and "Microsoft SQL Server Management Studio" when using SSMS. This cleary explains why Excel did not get any rows...sorry for bothering.
i have just started playing aorund with asp.net mvc and i want to view the database (aspnetdb.mdf) in sql server 2008 management studio
but it doesn't seem to let me view this file.
any suggestions?
You have to attach the database to the SQL Server instance using CREATE DATABASE FOR ATTACH or sp_attach_db, and then connect to the instance with SQL Server Management Studio to view the contents of the database. I am assuming that you are using SQL Express, which would mean that your application is configured to use User Instances where the connection string attaches the database to the SQL Server during code execution. This isn't a optimal way of doing things performance wise since you have to pay the cost to bring the database online repeatedly. If you attach the database permanently to the SQL Instance you will need to change the application connection string because the database can only be attached once since SQL Server takes an lock on the file to prevent it from being changed by another process.