Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Help me set up a database structure
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 10/20/2013 :  02:54:35  Show Profile  Reply with Quote
Alright guys, so I know the basics, however, I'm venturing into my first application using SQL.

So far, this is what I have, but it's only theory.

Database Name: Login
Table Name: Accounts
Table Contents (ID, Username, password, Email)

Database Name: World
Table Name: Characters
Table Contents: (Owner, Name)


What I'm trying to do is write an application that logs in-to our master-server using the login details stored in the "Login Database" then bring up a list of "Characters" for that user, the way I imagined doing this was by storing the "Owner" variable in the Characters Table. I would then search for all of the matches for the Characters where the "Owner" matched the "Username" of the account in the Login table.

Is this the correct way to do this?

I'm trying to write my first SQL Server application, although it's not going to be perfect, I want it to be done correctly, or what's the point in using SQL when I could just use text-files for data-storage.

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 10/20/2013 :  03:11:00  Show Profile  Reply with Quote
Assuming your both databases (Login and World) are in same server you can use like

USE [Login]
FROM dbo.Accounts a
INNER JOIN World.dbo.Characters c
ON c.Owner = a.Username

But IMO there's no need for separate dbs. You can keep the tables in the same database as there's no other settings that you need to apply separately for them
In that case the above query reduces to

FROM dbo.Accounts a
INNER JOIN dbo.Characters c
ON c.Owner = a.Username

SQL Server MVP
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000