Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Get DDL for any SQL 2000 table

By Lowell Izaguirre,

behind the scenes it's smart, complicated code. usage upfront is easy:

exec sp_GetDDL YourTableName
-- or

exec sp_GetDDL 'schemaname.tablename'

-- or

exec sp_GetDDL '[schemaname].[tablename]'

 

it produces well formatted CREATE TABLE scripts like this: note that some detail went into the spacing to make everything have a sharp appearance

CREATE TABLE [dbo].[TBSTATE] ( 
[STATETBLKEY]  INT                              NOT NULL,
[INDEXTBLKEY]  INT                              NOT NULL,
[STATECODE]    CHAR(2)                          NOT NULL,
[STATENAME]    VARCHAR(50)                      NOT NULL,
[FIPS]         CHAR(3)                              NULL,
CONSTRAINT   [PK__TBSTATE__17A421EC]                   PRIMARY KEY CLUSTERED    (STATETBLKEY),
CONSTRAINT   [STATECODEUNIQUE]                         UNIQUE      NONCLUSTERED (STATECODE))

Total article views: 702 | Views in the last 30 days: 3
 
Related Articles
SCRIPT

Get DDL for any SQL 2005 table

returns CREATE TABLE script for any table. including schema name,calculated columns, indexes with ...

FORUM

A little Help

Base on the code bellow, it actually works but the fact is that it does not show the complete create...

FORUM

A way to script all DBs from a server

A way to script all DBs from a server

FORUM

How to get Create script of an existing table

Hi, Is there any function which gives the table creation script. something like below create ...

FORUM

how to check table creation statement

Hi All Sorry but silly question .that is their any command or dmv by which we can check create st...

Tags
sql server 7    
 
Contribute