Click here to Skip to main content
15,885,546 members
Home / Discussions / Database
   

Database

 
AnswerRe: Architecture of .Net windows applications problem Pin
Colin Angus Mackay11-Dec-05 4:50
Colin Angus Mackay11-Dec-05 4:50 
GeneralRe: Architecture of .Net windows applications problem Pin
Michael P Butler11-Dec-05 5:03
Michael P Butler11-Dec-05 5:03 
GeneralRe: Architecture of .Net windows applications problem Pin
Colin Angus Mackay11-Dec-05 6:05
Colin Angus Mackay11-Dec-05 6:05 
Question"show create table" equivalent in MSSQL Pin
karanba11-Dec-05 1:58
karanba11-Dec-05 1:58 
AnswerRe: "show create table" equivalent in MSSQL Pin
Colin Angus Mackay11-Dec-05 4:48
Colin Angus Mackay11-Dec-05 4:48 
GeneralRe: "show create table" equivalent in MSSQL Pin
karanba11-Dec-05 5:01
karanba11-Dec-05 5:01 
GeneralRe: "show create table" equivalent in MSSQL Pin
Colin Angus Mackay11-Dec-05 5:15
Colin Angus Mackay11-Dec-05 5:15 
AnswerRe: "show create table" equivalent in MSSQL Pin
Fariborz Golara11-Dec-05 10:21
Fariborz Golara11-Dec-05 10:21 
Please see "CREATE TABLE" in "SQL Server Book Online"


*********************************************
CREATE TABLE
[ database_name.[ owner ] . | owner. ] table_name
( { < column_definition >
| column_name AS computed_column_expression
| < table_constraint > ::= [ CONSTRAINT constraint_name ] }

| [ { PRIMARY KEY | UNIQUE } [ ,...n ]
)

[ ON { filegroup | DEFAULT } ]
[ TEXTIMAGE_ON { filegroup | DEFAULT } ]

< column_definition > ::= { column_name data_type }
[ COLLATE < collation_name > ]
[ [ DEFAULT constant_expression ]
| [ IDENTITY [ ( seed , increment ) [ NOT FOR REPLICATION ] ] ]
]
[ ROWGUIDCOL]
[ < column_constraint > ] [ ...n ]

< column_constraint > ::= [ CONSTRAINT constraint_name ]
{ [ NULL | NOT NULL ]
| [ { PRIMARY KEY | UNIQUE }
[ CLUSTERED | NONCLUSTERED ]
[ WITH FILLFACTOR = fillfactor ]
[ON {filegroup | DEFAULT} ] ]
]
| [ [ FOREIGN KEY ]
REFERENCES ref_table [ ( ref_column ) ]
[ ON DELETE { CASCADE | NO ACTION } ]
[ ON UPDATE { CASCADE | NO ACTION } ]
[ NOT FOR REPLICATION ]
]
| CHECK [ NOT FOR REPLICATION ]
( logical_expression )
}

< table_constraint > ::= [ CONSTRAINT constraint_name ]
{ [ { PRIMARY KEY | UNIQUE }
[ CLUSTERED | NONCLUSTERED ]
{ ( column [ ASC | DESC ] [ ,...n ] ) }
[ WITH FILLFACTOR = fillfactor ]
[ ON { filegroup | DEFAULT } ]
]
| FOREIGN KEY
[ ( column [ ,...n ] ) ]
REFERENCES ref_table [ ( ref_column [ ,...n ] ) ]
[ ON DELETE { CASCADE | NO ACTION } ]
[ ON UPDATE { CASCADE | NO ACTION } ]
[ NOT FOR REPLICATION ]
| CHECK [ NOT FOR REPLICATION ]
( search_conditions )
}


**************************************
CREATE PROCEDURE Test2
AS
CREATE TABLE #t(x INT PRIMARY KEY)
INSERT INTO #t VALUES (2)
SELECT Test2Col = x FROM #t
GO
CREATE PROCEDURE Test1
AS
CREATE TABLE #t(x INT PRIMARY KEY)
INSERT INTO #t VALUES (1)
SELECT Test1Col = x FROM #t
EXEC Test2
GO
CREATE TABLE #t(x INT PRIMARY KEY)
INSERT INTO #t VALUES (99)
GO
EXEC Test1
GO

Here is the result set:

(1 row(s) affected)

Test1Col
-----------
1

(1 row(s) affected)

Test2Col
-----------
2


Fariborz Golara
GeneralRe: &quot;show create table&quot; equivalent in MSSQL Pin
Colin Angus Mackay12-Dec-05 4:55
Colin Angus Mackay12-Dec-05 4:55 
AnswerRe: &amp;quot;show create table&amp;quot; equivalent in MSSQL Pin
Mike Dimmick12-Dec-05 5:34
Mike Dimmick12-Dec-05 5:34 
GeneralRe: &amp;amp;quot;show create table&amp;amp;quot; equivalent in MSSQL Pin
karanba12-Dec-05 22:14
karanba12-Dec-05 22:14 
Questionfocus on row Pin
NikoTanghe9-Dec-05 22:50
NikoTanghe9-Dec-05 22:50 
Questionquestion Pin
eyalso9-Dec-05 22:05
eyalso9-Dec-05 22:05 
AnswerRe: question Pin
Colin Angus Mackay10-Dec-05 7:34
Colin Angus Mackay10-Dec-05 7:34 
QuestionADO with VS.Net Query Failure when Time is selected Pin
K.J.B.9-Dec-05 13:07
K.J.B.9-Dec-05 13:07 
Questionmanaging long data types Pin
kasko_9-Dec-05 11:42
kasko_9-Dec-05 11:42 
QuestionInconsistent Read issues Pin
tsramkumar9-Dec-05 9:31
tsramkumar9-Dec-05 9:31 
Questionadp.Fill method pooling issues Pin
Joshua Lunsford9-Dec-05 7:57
Joshua Lunsford9-Dec-05 7:57 
AnswerRe: adp.Fill method pooling issues Pin
Farhan Noor Qureshi9-Dec-05 12:00
Farhan Noor Qureshi9-Dec-05 12:00 
QuestionHelp - I'm a Novice - SQL Query Problem Pin
kabatlantafan79-Dec-05 5:20
kabatlantafan79-Dec-05 5:20 
AnswerRe: Help - I'm a Novice - SQL Query Problem Pin
miah alom9-Dec-05 5:58
miah alom9-Dec-05 5:58 
GeneralRe: Help - I'm a Novice - SQL Query Problem Pin
Farhan Noor Qureshi9-Dec-05 6:03
Farhan Noor Qureshi9-Dec-05 6:03 
GeneralRe: Help - I'm a Novice - SQL Query Problem Pin
miah alom9-Dec-05 6:03
miah alom9-Dec-05 6:03 
QuestionDiffering Results between Record binding (C++) and Collect method Pin
Stone Free9-Dec-05 3:42
Stone Free9-Dec-05 3:42 
QuestionCounter Pin
vuthaianh8-Dec-05 17:08
vuthaianh8-Dec-05 17:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.