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
 Table Definition

Author  Topic 

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-03-05 : 09:56:03
how to query Table definition (incase of stored procedure it is helptext)

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-05 : 09:57:06
EXEC sp_help 'table_name'

Madhivanan

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

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-05 : 09:58:12
or simply highlight the tablename in query analyser and press alt + F1

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-05 : 10:00:46
or follow this
http://beyondrelational.com/blogs/madhivanan/archive/2008/02/28/different-ways-to-know-structure-of-a-table.aspx

Madhivanan

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

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-03-05 : 10:03:29
Hi madhivanan,
i need the create statement script
[code]
create Table_name
(
sno int ,
name varchar(10)
)
[code]
through sqlstatment

quote:
Originally posted by madhivanan

EXEC sp_help 'table_name'

Madhivanan

Failing to plan is Planning to fail

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-05 : 10:07:03
Try this
http://beyondrelational.com/blogs/madhivanan/archive/2007/08/27/generate-sql-script.aspx

Madhivanan

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

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-03-05 : 10:12:10
when i try to Execute the below Stored Procedure ,it shows the below error

Msg 208, Level 16, State 1, Procedure GenerateScript, Line 31
Invalid object name 'Information_Schema.COLUMNS'



quote:
Originally posted by madhivanan

Try this
http://beyondrelational.com/blogs/madhivanan/archive/2007/08/27/generate-sql-script.aspx

Madhivanan

Failing to plan is Planning to fail

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-05 : 10:14:16
quote:
Originally posted by sent_sara

when i try to Execute the below Stored Procedure ,it shows the below error

Msg 208, Level 16, State 1, Procedure GenerateScript, Line 31
Invalid object name 'Information_Schema.COLUMNS'



quote:
Originally posted by madhivanan

Try this
http://beyondrelational.com/blogs/madhivanan/archive/2007/08/27/generate-sql-script.aspx

Madhivanan

Failing to plan is Planning to fail




are you using ms sql server?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-05 : 10:16:10
Instead of

Information_Schema.COLUMNS

use

INFORMATION_SCHEMA.COLUMNS


Madhivanan

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

- Advertisement -