Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    4

    Unanswered: Linking SQL Server Databases AND Data Formatting like InputMask

    Hi

    I have two questions : 1) Linking SQL Server Databases
    2) Data Formatting like InputMask

    1) I want to know if there is a way to link two seperate SQL server databases (it's tables) within the same server (local server). I created one Global database - with clients, etc. tables. The reason I did it like this is that I have to handle three seperate invoices databases, but using the same clients, etc. tables to get their information from. I used MS Access like this, linking Clients, etc tables from the Clients Database with the three other Databases. It worked fine but now I need some new features like setting the InvoiceNumber to something different, eg . 04/0001 for this year and then 05/0001 for next year. My Access databases can't change this numbers - it's just a autonumber I used. I know some Visual Basic code can make a change like perhaps adding a new column like InvYear and then adding it together with InvoiceNumber to get the Invoice Number, but I want to change it to SQL Server because I want to learn how SQL Server works. I am just starting out and not doing courses.

    2) The other thing is I want to know if there is some feature in SQL Server to make data input easier, like a InputMask in Access where you can let a text column be formatted as you want. Eg. for a telephone number, it can store it in the format you made; like (011) 123 4567, not like you typed it : 0111234567.

    I would appreciate some help.

    Thank you

    Corné

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Yes, you can reference a practical infinity of databases on a given server, so you could put the client informaiton in one database, and the invoice information into three separate databases if that suits your needs better. I'd be inclined to change the design of the invoices table and organize it as one table of invoices instead of three, with a column to indicate which of your "sets" (year, companies?) of invoices a particular invoice belongs.

    Display formatting is a client side issue. You can use Access (the GUI database) to access SQL Server as a database engine instead of Jet (the Access default database engine). In that case, you can let Access do the formatting for you. If you choose another client-side tool, then it can do the formatting for you.

    -PatP

  3. #3
    Join Date
    Mar 2004
    Posts
    4
    Thanks for the response Pat

    Now I want to know HOW to link the databases on the same server.
    It's a nice idea for using only one table for invoices for the seperate companies - I think I'm going to do that.

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Originally posted by ChameleonDevil
    Now I want to know HOW to link the databases on the same server.
    Maybe I'm missing something here. You know about three part names, right? Something as splendidly useful as:
    PHP Code:
    SELECT su.name AS usernamesl.name AS loginame
       FROM dbo
    .sysusers AS su
       JOIN master
    .dbo.syslogins AS sl
          ON 
    (sl.sid su.sid
    This basically shows the database users with their SQL login names. It doesn't do database roles, and it doesn't do NT users that are granted access via server role membership, but it's still kind of cute and a good example of how to reach data in another database.
    Originally posted by ChameleonDevil
    It's a nice idea for using only one table for invoices for the seperate companies - I think I'm going to do that.
    Somehow I thought you might like that!

    -PatP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •