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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 CREATE TABLE syntex (which DB, new table pertains)

Author  Topic 

Faraz Ahmed Qureshi
Starting Member

3 Posts

Posted - 2010-07-17 : 16:27:56
Dear friends,

Sure am new SQL as well as this forum. It's my first question. Using MS SQL Server 2008. Have created few databases with clicks. However, to create a Table via SQL sure wanna know the correct complete syntax of CREATE TABLE so as to make sure the new table should belong to a specific database for instance create a SP_TABLE (with SP_COL of VARCHAR) for SP_DB.

Thanx in advance,
Best Regards,
Faraz Ahmed Qureshi

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-17 : 16:46:49
You can check out the syntax in SQL Server Books Online in the CREATE TABLE topic (go to the index tab and type it in). BOL is the documentation for SQL Server.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Bea
Starting Member

7 Posts

Posted - 2010-07-18 : 03:46:33
Hello Faraz

Here is a simple example

USE SP_DB

CREATE TABLE SP_TABLE
(
SpIDint IDENTITY(1,1) PRIMARY KEY,
SP_COL varchar(20),
)

Hope this helps
Bea
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-07-19 : 06:58:47
quote:
Originally posted by Bea

Hello Faraz

Here is a simple example

USE SP_DB

CREATE TABLE SP_TABLE
(
SpIDint IDENTITY(1,1) PRIMARY KEY,
SP_COL varchar(20),
)

Hope this helps
Bea


The column SpIDint should have a datatype

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -