Accessing SQL Server from client

  • How do I do the following from a client?

    1. Create a database on my SQL Server.

    2. Create a table with the database.

    3. Add information within that table.

    TIA

    -Andre

  • What you can do is create the database in sql server as you want. Then script the database though EM, with all the objects in it and save it to a .txt file. Then drop the database from SQL Server. With in your app, execute a shell command with the OSQL command (See BOL for more info.) With OSQL you can connect to SQL server and execute a file as input. The file you specified is the one you created before.

    With the question about adding info to the tables, you can do it in a similar way by creating a file with all the inserts.

  • Many areas of possibility, if you want to code this the SQLDMO is probably your best option. This is want enterprise manager is based on

    Simon Sabin

    Co-author of SQL Server 2000 XML Distilled

    http://www.amazon.co.uk/exec/obidos/ASIN/1904347088


    Simon Sabin
    SQL Server MVP

    http://sqlblogcasts.com/blogs/simons

  • depends also on the client you could use ado or ado.net as well.

  • For a simple table doing it from ADO/.Net would work. Work out what the command should be in Query Analzyer, then just do a connection.execute "create table..." in your app.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply