[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 205
  • Last Modified:

Export SQL tables

Hi,

I need to do a very simple task, but can't see a way to do it. I have over 300 hundred tables in one of my databases and would like to just export the names of these tables into a spreadsheet so i can show a colleague what the tables are called.

Is there a way to do this?

Thanks
0
monarchit
Asked:
monarchit
  • 3
  • 2
1 Solution
 
zadeveloperCommented:
Yea

select * from sysobjects where xtype = 'u'

Open in new window

0
 
zadeveloperCommented:
or for just the table names
select [name] from sysobjects where xtype = 'u'

Open in new window

0
 
waltersnowslinarnoldCommented:
Try the following code sample..,


insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D:\Walter\testing.xls;',
'SELECT * FROM [testing$]') select * from ProductTable
0
 
waltersnowslinarnoldCommented:
Sorry for table names,use the following.,

insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D:\Walter\testing.xls;',
'SELECT * FROM [testing$]') select name FROM sys.objects WHERE type='u'
0
 
zadeveloperCommented:
From excel - step by step:
1. Open excel and goto Dat menu option and select: "From Other Source",
2. Select from SQL Server and fill in the server details.
3. Select the database as prompted
4 enter in the query : select * from sysobjects where xtype = 'u'
select * from sysobjects where xtype = 'u'

From SQL Management Studio:
New Query -
Use  %Database%
select * from sysobjects where xtype = 'u'
The right click on the results and say export
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now