How to Create a New Microsoft SQL Server Database and Table Using the OSQL Utility.
1. Login to the tool:
C:\temp> osql -E
1>
Notes:
Use the -U flag when server is not running as system and needs a user login.
If you are successful, you'll see the 1st SQL command line number "1>".
2. Create a new database using the Create Database command
1> CREATE DATABASE MyDatabase
2> GO
3. Create the a new table in the database
1> USE MyDatabase
2> GO
1> CREATE TABLE Employees
2> (Primarykey INT PRIMARYKEY, LastName NVARCHAR(32), FirstName NVARCHAR(32), HireDate DATETIME)
3> GO
previous page
|