Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

small database creation

Status
Not open for further replies.

murzina

Programmer
Jan 14, 2009
14
What syntax is used for setting up a small database in SQL Express?

For instance,

CREATE USER Alex
WITHOUT LOGIN

CREATE Table zipcodes;
 
Create Database AnyDatabaseNameYouWant

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
The same as in all other versions of SQL Server:
Code:
CREATE DATABASE Alex
GO
USE Alex
GO
CREATE TABLE ZipCodes (Field list with field types here)
GO

Keep in mind that GO is not a T-SQL Command it is just a batch terminator.

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
So would that be a correct code below?


Create Database Zipcodes;
GO
Create Table Distance
(ZipCodes Number(5),
Radius Number(5),
KM_MI varchar(30),
Calling_Website varchar(100));
GO
Insert into Distance
Values (46835, 5, 'Km', 'GO
 
Nope, you should make sure that the newly created DB becomes current before you create table and insert something into it:
Code:
Create Database Zipcodes;
GO
[COLOR=red][b]
USE Zipcodes
GO
[/b][/color]
Create Table Distance (ZipCodes Number(5),
                       Radius Number(5),
                       KM_MI varchar(30),
                       Calling_Website varchar(100))
GO
Insert into Distance
Values (46835, 5, 'Km', '[URL unfurl="true"]www.website.com');[/URL]
GO

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top