April 2, 2007 at 9:24 pm
Hi
I've been looking for a script that would do this, as an Oracle DBA has asked to see if I knew.
He says there is a simple command he uses in Oracle like 'show' or something which does it but there isn't anything like that in MSSQL.
Does anybody know of a script that would do it?
Thanks
April 2, 2007 at 10:51 pm
In Query Analyzer in Object Browser (press F8 to open it) right-click on the table, then choose "Script Object ..." - whatever you need.
_____________
Code for TallyGenerator
April 2, 2007 at 10:58 pm
Thanks Sergiy
Problem is he wants to run it from a stored proc, so it has to be all t-sql.
I have found some code to script everything but it's difficult to extract just the table part.
The code is below.
http://www.nigelrivett.net/DMO/DMOScriptAllDatabases.html
Paul
April 2, 2007 at 11:10 pm
What's your point?
Create another table with the same structure as existing one?
Then just do this:
SELECT *
INTO dbo.NewTable
FROM dbo.ExistingTable
WHERE 1=0
If not just explain what are you trying to achieve.
_____________
Code for TallyGenerator
April 2, 2007 at 11:11 pm
sp_Help tablename is what most folks are looking for. Similar to "describe" in Oracle. Lemme know if that's not quite what you wanted.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply