Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
CTucker1327
Starting Member
1 Post |
Posted - 2013-10-20 : 02:54:35
|
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: LoginTable Name: AccountsTable Contents (ID, Username, password, Email)==========================================================Database Name: WorldTable Name: CharactersTable 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. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-10-20 : 03:11:00
|
Assuming your both databases (Login and World) are in same server you can use likeUSE [Login]GOSELECT *FROM dbo.Accounts aINNER JOIN World.dbo.Characters cON 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 themIn that case the above query reduces toSELECT *FROM dbo.Accounts aINNER JOIN dbo.Characters cON c.Owner = a.Username ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
|
|
|
|
|