show relationships like Access - sql

Is there a way to show table relationships as can be done in Access? Consider two tables:
Services
serviceid
application id
Application
application id
application name
I have already set up the diagram.
When opening the table service id I want to see the related application details like in Access.
Is this possible?

First of all, you an always use access to connect to SQL Server and see relationships through it.
The built in database diagram feature will also show relationships, as you describe. You can find it under the database in question in the diagrams node.
Here is an article about different options to produce an ERD.
Update:
In order to see results, I would suggest using access to connect to SQL Server, as described in the link above.
The SQL Server GUI does not have this facility, and if you want to see results from several tables you need to write the SQL queries that will generate the wanted data.

You could also create a VIEW:
CREATE VIEW ServicesApplication AS
SELECT S.ServiceID, S.ApplicationID, A.ApplicationName
FROM Services AS S
LEFT JOIN Applications AS A
ON S.ApplicationID = A.ApplicationID
That way you can always access the coupled data easily by manipulating the ServicesApplication view instead of the separate tables.

SQL 2008 doesn't have anything built in to provide that functionality. Almost sounds like you're looking to trouble shoot an application by looking at database entries...if thats true I'd recommend learning tsql well enough to write these statements as you need and not rely on another application to provide a visual interface. heh, if I'm completely wrong with that, ignore me :)
If you still want the 3rd party application route...I beleive TOAD has that functionality within it, though I've never connected it to a MS SQL 2008 server before. There are other third party applications out there that will provide this functionality, though I imagine they aren't all free. If you're looking for a free solution and already have Access going, Oded probably has the best idea here...connect MS access to the SQL 2008 server (linked tables) and use MS access to provide the features you want from ms access :)

Related

How to create a SQL database within VB.net?

I am currently creating a vb.net program in which users upload a song file to the program and then it is saved within the programs files. I have set up the actual saving of the files but would also like to store some meta data of each in a SQL database within my program.
I have looked online and although i now understand the basics of SQL, im still a little fuzzy on how you actually implement this within VB.net. I have already added the library- Imports System.Data.SqlClient but failed to work out how to begin coding in SQL.
The basics of what im trying to acheive is a if statement that will determine wether or not a SQL database has been created in a specific location, and if it hasnt it should create it.
All constructive answers appreciated, thanks.
There are a number of different database engines available. The namespace that you have chosen contains the ADO.NET client classes for Microsoft SQL Server. You would use a connection string to specify how to connect to the database. This would often contain connection information, such as server name, user name, password etc, but it sounds like you want to store data locally.
There is a local version of SQL Server called LocalDB, but I think you would still need quite a lot of the SQL Server components installed for that to work. Although you can package these with your application they may be too large for you, so you may want to look at SQL Server Compact Edition, which is much smaller and allows you to package the whole engine as part of your application and is useful for storing data locally. Compact edition doesn't have quite all of the features that LocalDB does, so you may want to compare the features available for each.
Although you can use the ADO.NET objects to connect to a database, I think most people these days would use a layer on top which transfers data back and forwards between objects in memory and the database. This also allows you to use Linq to query the database in most cases. I personally use Entity Framework. You might want to look into that. There are different ways of configuring EF so you may want to look at a tutorial. Once you have it set up, you will probably find it much easier and safer to work with than writing SQL manually though.

Access as front-end for SQL Server Issues

I have recently converted my Access (2010) database to SQL server (2008) and am attempting to use Access as the front-end. The issues I am having are with sorting and filtering columns within Access. Sorting essentially doesn't work for most columns - does not end up with alphabetically/numerically ordered rows. Also filtering columns will not work consistently either. It will sometimes perform the first filter correctly, but when I change the criteria it will not work and typically shows 0 rows.
I have looked around, but can't seem to find anyone else running into this issue. Are these known bugs with this configuration?
Also, are there any other alternatives similar to Access as a front-end for SQL server? My users require similar functionality that Access provides - filter, sorting, editing data, and they do not want to write any SQL to do this. I would like to not have to create a custom front-end, but I am starting to think this may be my only option.
Thanks!
Warning: I have not used Access much as a front-end to SQL Server.
Came across this article on using a new feature of Access, "Access Data Project", that might be something to look at. It seems to offer a little bit more functionality than the traditional method of linked tables in Access. Allows for a little bit more use of SQL Server T-SQL features than having to depend on Access's native language.

ADO.Net synchronization services filter

I have a VB.Net windows application in Visual Studio 2010 that I want to use ADO.Net synchronization services and only synchronize a subset of the data in each table. The main database with all of the data is in SQL Server 2008 R2, the LocalDataCache is using Compact SQL. I have found several examples like: http://msdn.microsoft.com/en-us/library/bb726003(v=sql.100).aspx#Y1947 but they are very confusing.
If I have a table in SQL Server that has rows of data in it for several users, but I only want to see 1 user's data, I want to only synchronize this one users data. The primary key of the table is a GUID, I want to set the Filter Criteria to be something like: UserID = 'A34D81B5-EF3F-4B57-B795-F7F2D3B9DBA0'
I've looked at this and cannot get it to work for me:
Sync Framework : Can I Sync only a subset of my tables?
All of the examples I have found seem to be making this way more difficult than it seems like it should be. Does anyone have a simple example of how to bidirectionally keep SQL CE in sync using a filter like this?
I have added the item: Local Database Cache and it works great if I want to synchronize the entire database to the Compact SQL, but I don't want all of the rows of data. I want all of the columns, but want to filter the rows that it keeps in sync.
None of the code snippets that I have found work end to end... they are all very vague and this is totally new to me. I have never use Compact SQL before.
Thanks!

Asp.net database table relationships

I am looking at a way to establish a few tables in my database.
I want to connect every user that logs in to the comments that they leave. There should be 2 or 3 tables. But I have no understanding on how to achieve this. Does anyone know where I can read and learn about how to build table relationships effectively?
You should understand how 'joins' work. They will define how you access your data later.
Check out this site:
http://www.sql-tutorial.net/SQL-JOIN.asp
Even if you don't have MS Access, this is a good tutorial for getting a handle on creating tables and defining relationships.
http://office.microsoft.com/en-us/training/design-tables-for-a-new-access-2007-database-RZ010286445.aspx
Also, "SQL for Dummies" is a great reference to have. Get a used copy on Amazon.
Here's a walk-through for SQL Server 2005: http://dotnetguts.blogspot.com/2007/10/basics-of-sql-server-2005.html

Counting database applications

How can we find out that how many applications are there in a database?
Not entirely sure what you're asking for here. I'm assuming you mean "Applications written using SQL Server 2005 as the database.".
If that's what you want to know, I don't know of any single place you could get that information by it's always a good idea to try starting here.
Do you mean stored procedures? You can have multiple applications using the same login credentials accessing a given database from the same web server, so you can't simply count databases or tables to get that number.